4 ms·
My recent gripe with CMake: the language toolchain is still a singleton. You can't easily use multiple C++ compilers in the same build. This doesn't feel like a
by planede 4y ago
My recent gripe with CMake: the language toolchain is still a singleton. You can't easily use multiple C++ compilers in the same build. This doesn't feel like a language limitation.
I also never got why we need DSLs for build systems. It seems like Turing completeness is often inevitable, no matter if people don't like it. There is no reason that a build file couldn't be mostly declarative with a general-purpose programming language though.
- matthews2 4y ago> the language toolchain is still a singleton. You can't easily use multiple C++ compilers in the same build. This doesn't feel like a language limitation If you're still struggling with this, a solution is to use ExternalProject to create a "superbuild" top level project that has various subprojects being built with different toolchains.
- mdaniel 4y ago> I also never got why we need DSLs for build systems The same reason they show up anywhere: to have the correct level of abstraction, or its cousin "signal/noise ratio." Trying to debug "gcc -o build build.cc && ./build" sounds like the 8th circle of hell to me. I can show a concrete example: https://github.com/facebook/sapling/blob/0.1.20221201-095354-r360873f1/eden/scm/setup.py https://github.com/facebook/sapling/blob/0.1.20221201-095354... So, when this raises OSError or FileNotFoundError due to some botched assumption, I guess one just attaches pdb to it and now your job is to be a python expert Or, my other favorite "what is wrong with you:" https://hg.mozilla.org/mozilla-central/file/FIREFOX_NIGHTLY_108_END/mach https://hg.mozilla.org/mozilla-central/file/FIREFOX_NIGHTLY_... Or, so as to not just be hating on python, this junk: https://github.com/brave/brave-browser/blob/v1.48.33/package.json#L214 https://github.com/brave/brave-browser/blob/v1.48.33/package... and its https://github.com/brave/brave-core/blob/master/build/commands/scripts/commands.js https://github.com/brave/brave-core/blob/master/build/comman... friend All of those are in a general purpose programming language, and they require spelunking through thousands of lines of code to surface the actual commands and dependencies that are buried therein. And, if you become a domain expert in mach, where else are you going to apply that expertise?
- planede 4y ago> So, when this raises OSError or FileNotFoundError due to some botched assumption, I guess one just attaches pdb to it and now your job is to be a python expert Well, debugging cmake files is not any better, in my experience. And I can't even attach a debugger. I can rely on printf debugging or pray that cmake with --trace or --trace-source has the relevant information I need (often it doesn't). edit: Well, your disgust is justified against ad-hoc imperative build systems that happen to use a general-purpose programming language. It doesn't have to be like this. I liked the idea of scons, for example, unfortunately it had other problems.
- mdaniel 4y agoI hear you about debugging cmake (although in this specific case JetBrains has a CMake debugger: https://blog.jetbrains.com/clion/2022/10/clion-2022-3-eap-cmake-debugger/ https://blog.jetbrains.com/clion/2022/10/clion-2022-3-eap-cm... ) but one can also concede that the magnitude of code one even needs to consider are not in the same universe as each other: $ cd mozilla-central $ find python/mach python/mozbuild/mozbuild -name '*.py' -exec cat '{}' ';' | wc -l 83088 $ find keepassxc -name CMakeLists.txt -o -name '*.cmake' -type f -exec cat '{}' ';' | wc -l 866 I am on-board with something like Starlark, which is allowed to make reasonable build decisions with the information available to it, but is prevented from mutating my system. I try to be very disciplined about reading every .gradle file carefully, because jokers love to do whatever they want when they have a full-blown programming language available to them