!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

560 Members
119 Servers

Load older messages


SenderMessageTime
1 Jan 2026
@symphorien:xlumurb.eusymphorienas nativeBuildInputs sorry17:41:19
@sielicki:matrix.orgsielicki it exists as a setuphook in cmake 17:41:22
@symphorien:xlumurb.eusymphorienand in this file, the value cmakeToolchainHook is built with the same stdenv as cmake17:42:22
@sielicki:matrix.orgsielickiyour concern, if i understand correctly, is that the toolchain will be evaluated with the bare stdenv instead of the pkgsCross stdenv, yes? 17:45:00
@symphorien:xlumurb.eusymphorienyes17:45:14
@sielicki:matrix.orgsielicki* your concern, if i understand correctly, is that the toolchain.cmake text file will be evaluated with the bare stdenv instead of the pkgsCross stdenv, yes? 17:45:17
@symphorien:xlumurb.eusymphoriento fix it you should replace (stdenv.buildPlatform, stdenv.hostPlatform) by (stdenv.hostPlatform, stdenv.targetPlatform)17:46:06
@symphorien:xlumurb.eusymphorien but very few packages depend on targetPlatform 17:46:37
@zimward:zimward.moezimward joined the room.17:46:40
@symphorien:xlumurb.eusymphorienand introducing new ones is not a light decision17:46:53
@symphorien:xlumurb.eusymphorien (if I undersant Alyssa Ross correctly) 17:47:24
@symphorien:xlumurb.eusymphorienif the terminolofy about platforms is unclear I can try to explain more17:47:53
@symphorien:xlumurb.eusymphorien * 17:48:01
@sielicki:matrix.orgsielickimy thought is that any given stdenv, regardless of whether it's exposed as pkgs.stdenv or pkgs.pkgsCross.foobar.stdenv, has buildPlatform and hostPlatform. buildPlatform is where it's building, hostPlatform is where it will run, and targetPlatform is just a notion for the antiquated gcc-ism where a compiler runs on buildPlatform but can only produce code for targetPlatform. 17:49:26
@sielicki:matrix.orgsielickiI 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
@symphorien:xlumurb.eusymphorienno because your hook is built when building cmake17:51:00
@symphorien:xlumurb.eusymphorienso 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 targetPlaform17:52:02
@sielicki:matrix.orgsielickiI 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 outputs17:53:31
@sielicki:matrix.orgsielickiregardless of whether I'm doing that atm in this repo17:53:52
@symphorien:xlumurb.eusymphorienwhen 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-defined17:54:28
@symphorien:xlumurb.eusymphorienthen how do you plan for each derivation to choose the correct toolchain.cmake ?17:55:20
@qyliss:fairydust.spaceAlyssa RossYou will find a lot of agreement on this.17:58:21
@qyliss:fairydust.spaceAlyssa RossWe've moved away from implicit hooks for newer build systems17:58:31
@qyliss:fairydust.spaceAlyssa Ross In favour of having an e.g. cmakeBuildHook that does all the automatic stuff, and which can be built separately. 17:59:16
@sielicki:matrix.orgsielicki 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
@sielicki:matrix.orgsielickithanks all for the input, I'll play around a bit more with this18:03:16
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)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 nixpkgs18:03:17
@xokdvium:matrix.orgSergei Zimmerman (xokdvium) It would be nice if the hooks were bound to the stdenv and were memorised accordingly 18:03:51
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)* It would be nice if the hooks were bound to the stdenv and were memoised accordingly18:04:04
@zimward:zimward.moezimwardcan 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

Show newer messages


Back to Room ListRoom Version: 6