-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[jsonifier, discordcoreapi] Fix build hangs and warnings. #42355
Conversation
2 potential causes: * At least in my testing, build requires >9GB per core of memory, which might have been 'hanging' by causing the OOM killer to kill the agent. * There are 'sub' CMake builds which write to the source tree and stomp on each other. Related: RealTimeChris/Jsonifier#35
/cc @RealTimeChris |
TBH discordcoreapi is fairly strange CMake code. As an addtional note, the package optimizes for the capabilities of the physical host CPU. It is unable to cross-build. Taking a second look, this trouble starts at jsonifier. (I do acknowledge that the source code offers excellent optimizations. I'm unhappy with CMake code and the ports.) |
The build taking a long time/extreme RAM consumption should be fixed by the new tuple implementation I've added to Jsonifier since its last release. Let me push the changes to main. |
You can cross-compile, you just need to set JSONIFIER_CPU_INSTRUCTIONS flag to correctly align with whichever target CPU architecture you're compiling for. |
Looks like this fixed the warnings on Windows, taking forever on macOS, and the OOM killer on Linux: Elapsed time to handle discordcoreapi:x64-osx: 1 min |
I agree that, for example, invoking a sub complete CMake build is a little unorthodox, but unless it is causing problems for other ports I don't think it should be deindexed for that.
That's true, but it's hardly the only port to do that. I don't think we have settled on a great answer to this situation: It's true that changing stuff based on the host CPU is bad for binary caching, but the alternative of force disabling all such optimizations makes ports that care about doing this useless for their customers much of the time, so we haven't tried to ban it despite the potential issues.
Awesome, thanks! |
I started to study this already. Jsonifier comes as header-only. It shouldn't need to commit to a particular CPU, but it burns the host CPU type into a header. Even worse, it forces its compile flags on consumers. |
My mistake the -march=native should have never been in there and I've removed the /fp:fast from msvc. Also I will look into trying runtime methods for detecting the CPU architecture, as long as it doesn't ruin performance. |
2 potential causes:
Related: RealTimeChris/Jsonifier#35
Related: #40229