Nix Cross Compiling | 575 Members | |
| 126 Servers |
| Sender | Message | Time |
|---|---|---|
| 1 Jan 2026 | ||
| I don't think that applies here, though. If stdenv.cc is set correctly, it encodes targetPlatform. cmake still only cares about buildPlatform and hostPlatform. No? | 17:50:22 | |
| no because your hook is built when building cmake | 17:51:00 | |
| so cmake is interested in the plaform where cmake will be executed (which will then be the build plaform, but when building the hook is the hostPlaform) and the targetPlaform | 17:52:02 | |
| I don't think the hook ought to be built when building cmake. That's kind of the point, the same cmake binary can be used with many different toolchain.cmake outputs | 17:53:31 | |
| regardless of whether I'm doing that atm in this repo | 17:53:52 | |
| when building pkgsCross.aarch64-multiplatform.opencv on x86_64, cmake and your hook are called with and stdenv with build=host=x86_64 and target=aarch64 whereas opencv is called with a stdenv with build=x86_64 and host=aarch64 and target is ill-defined | 17:54:28 | |
| then how do you plan for each derivation to choose the correct toolchain.cmake ? | 17:55:20 | |
| You will find a lot of agreement on this. | 17:58:21 | |
| We've moved away from implicit hooks for newer build systems | 17:58:31 | |
In favour of having an e.g. cmakeBuildHook that does all the automatic stuff, and which can be built separately. | 17:59:16 | |
| symphorien: I don't think we even need to write the toolchain to the nix store as a derivation. I'm kind of spitballing here, but I guess this could just be a pure nix string handled by the existing lib.systems.parse code | 18:00:35 | |
| thanks all for the input, I'll play around a bit more with this | 18:03:16 | |
| Speaking of the current cmake situation, the system where cmakeFlags and mesonFlags are constructed in make-derivation has quite big overhead. makeCMakeFlags and makeMesonFlags are one of the hotter functions in the whole of nixpkgs | 18:03:17 | |
| It would be nice if the hooks were bound to the stdenv and were memorised accordingly | 18:03:51 | |
| * It would be nice if the hooks were bound to the stdenv and were memoised accordingly | 18:04:04 | |
| can someone explain to me why i get a gcc that targets x86_64-linux in a derivation from a stdenv that has riscv32-none-elf as its target? | 18:06:22 | |
In reply to @zimward:zimward.moe $CC is that? | 18:55:02 | |
| Reproducer? | 18:55:07 | |
like nix develop nixpkgs#legacyPackages.x86_64-linux.pkgsCross.riscv32-embedded.newlib-nanothere is also the correct gcc in there with the target triplet prefix (and is set as the CC, but when i add cflags it tries to use the incorrect gcc) | 19:01:33 | |
| 19:54:37 | ||
| https://github.com/NixOS/nixpkgs/blob/700a15863ef33cc39478ac9a2ae5a92b3f4ad25e/pkgs/by-name/ne/newlib/package.nix#L39-L48 | 20:17:17 | |
gcc is always the for build gcc | 20:25:07 | |
| It doesn't exist when cross-compiling without buildPackages.stdenv.cc in depsBuildBuild | 20:25:29 | |
| 20:54:59 | ||
| 2 Jan 2026 | ||
| 20:26:41 | ||
| 5 Jan 2026 | ||
| Alyssa Ross: any chance you can take another look to #458935? John Ericson made some other suggestions that have been implemented. | 10:50:27 | |
| 6 Jan 2026 | ||
Thanks <3 I'm so happy :) | 17:49:19 | |
| 9 Jan 2026 | ||
| where do platform symbols like loongarch come from? I hit symbol issues in libffi when trying to build cross-compiling GHC on several platforms For instance, I'm getting https://github.com/libffi/libffi/blob/2263d6037f8ef6b8d5bef14117ad1a17c32a20b9/src/loongarch64/ffitarget.h#L66 which should mean __loongarch64 isn't defined, but loongarch is or the error on line 39 would trigger first I see both of them in https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html but don't know where they're supposed to come from | 12:07:45 | |
* where do platform symbols like __loongarch__ come from?I hit symbol issues in libffi when trying to build cross-compiling GHC on several platforms For instance, I'm getting https://github.com/libffi/libffi/blob/2263d6037f8ef6b8d5bef14117ad1a17c32a20b9/src/loongarch64/ffitarget.h#L66 which should mean __loongarch64 isn't defined, but __loongarch__ is or the error on line 39 would trigger firstI see both of them in https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html but don't know where they're supposed to come from | 12:08:15 | |
| the compiler defines them based on the selected/configured target | 12:12:39 | |