!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

579 Members
128 Servers

Load older messages


SenderMessageTime
1 Jan 2026
@sielicki:matrix.orgsielicki joined the room.17:30:54
@qyliss:fairydust.spaceAlyssa RossGenerally we try to avoid targetPlatform17:31:00
@qyliss:fairydust.spaceAlyssa RossIt might be less objectionable once to do it in the CMake hooks once they're separated from the cmake package.17:31:17
@sielicki:matrix.orgsielickithe context is this idea: https://github.com/sielicki/nix-cmake/blob/main/pkgs/cmake-toolchain-hook/cmake-toolchain.nix17:31:39
@sielicki:matrix.orgsielickitargetPlatform is used unnecessarily there, I only use it as a comment to identify the stdenv (probably, incorrectly/imprecisely)17:32:48
@symphorien:xlumurb.eusymphorien so on x86 when you build pkgsCross.aarch64-multiplatform.something_that_uses_cmake, when building cmake, the hostplatform is x86 (the one running cmake) the buildplatform is x86 and only the targetplatform is aarch64 17:34:43
@sielicki:matrix.orgsielickihostPlatform is aarch64, no? 17:35:24
@symphorien:xlumurb.eusymphorienif I understand correctly your proposal is to make cmake effectively a cmake-wrapped-with-its-toolchain-config17:35:33
@qyliss:fairydust.spaceAlyssa Rossfor cmake it's x86_6417:35:36
@qyliss:fairydust.spaceAlyssa RosshostPlatform is the platform the package runs on. you are running CMake on x86_6417:35:51
@symphorien:xlumurb.eusymphorien when building cmake the hostplatform is the platform running cmake, so the buildplatform of, say, opencv if you are building opencv 17:36:10
@sielicki:matrix.orgsielickicmake pulls in this hook the same way that it pulls in its current build hooks, so this doesn't build at the same time that cmake does17:38:29
@symphorien:xlumurb.eusymphorienare the hooks built with the same stdenv as cmake ?17:38:56
@sielicki:matrix.orgsielickithis hook doesn't depend on cmake, either -- it's purely a transformation from properties on stdenv to /some text file/, which just so happens to be readable by cmake17:39:14
@sielicki:matrix.orgsielickiI guess they can be, but they don't have to be. 17:39:33
@symphorien:xlumurb.eusymphorienthen do you mean one would have to add your hook to all derivations as buildInputs ?17:39:54
@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

Show newer messages


Back to Room ListRoom Version: 6