!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

555 Members
119 Servers

Load older messages


SenderMessageTime
19 Aug 2025
@artturin:matrix.orgArtturinI don't use binfmt15:22:51
@artturin:matrix.orgArtturin { crossSystem = lib.systems.examples.aarch64-multiplatform; } 15:25:28
@artturin:matrix.orgArtturin or crossSystem = "aarch64-unknown-linux-gnu" or crossSystem.config = "aarch64-unknown-linux-gnu" 15:27:05
@artturin:matrix.orgArtturinhttps://github.com/NixOS/nixpkgs/blob/master/lib/systems/examples.nix15:27:26
@quadradical:federated.nexusQuadRadical (Ping) thank you 17:00:59
@quadradical:federated.nexusQuadRadical (Ping)yeah i got that after you explained what pkgs.path is17:01:08
20 Aug 2025
@quadradical:federated.nexusQuadRadical (Ping) for binfmt though dont i have to set smth globally 00:42:05
@quadradical:federated.nexusQuadRadical (Ping)dont i need to set boot.binfmt.emulatedSystems?00:42:13
@quadradical:federated.nexusQuadRadical (Ping)maybe it would be easiest to build everything on binfmt except for a few packages00:44:34
@jopejoe1:matrix.orgjopejoe1 (4094@39c3) changed their display name from jopejoe1 (4094@GPN23) to jopejoe1.18:50:11
21 Aug 2025
@creepinson:matrix.orgTheo Paris joined the room.22:10:34
@emilazy:matrix.orgemily

Artturin: does this targetPackages stuff from Rust seem as dodgy stage-wise to you as it does me

      prefixForStdenv = stdenv: "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}";
      ccPrefixForStdenv =
        stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang" else "cc"}";
      cxxPrefixForStdenv =
        stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang++" else "c++"}";
      setBuild = "--set=target.${stdenv.buildPlatform.rust.rustcTarget}";
      setHost = "--set=target.${stdenv.hostPlatform.rust.rustcTarget}";
      setTarget = "--set=target.${stdenv.targetPlatform.rust.rustcTarget}";
      ccForBuild = ccPrefixForStdenv pkgsBuildBuild.targetPackages.stdenv;
      cxxForBuild = cxxPrefixForStdenv pkgsBuildBuild.targetPackages.stdenv;
      ccForHost = ccPrefixForStdenv pkgsBuildHost.targetPackages.stdenv;
      cxxForHost = cxxPrefixForStdenv pkgsBuildHost.targetPackages.stdenv;
      ccForTarget = ccPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv;
      cxxForTarget = cxxPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv;
22:29:41
@artturin:matrix.orgArtturin
In reply to @emilazy:matrix.org

Artturin: does this targetPackages stuff from Rust seem as dodgy stage-wise to you as it does me

      prefixForStdenv = stdenv: "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}";
      ccPrefixForStdenv =
        stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang" else "cc"}";
      cxxPrefixForStdenv =
        stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang++" else "c++"}";
      setBuild = "--set=target.${stdenv.buildPlatform.rust.rustcTarget}";
      setHost = "--set=target.${stdenv.hostPlatform.rust.rustcTarget}";
      setTarget = "--set=target.${stdenv.targetPlatform.rust.rustcTarget}";
      ccForBuild = ccPrefixForStdenv pkgsBuildBuild.targetPackages.stdenv;
      cxxForBuild = cxxPrefixForStdenv pkgsBuildBuild.targetPackages.stdenv;
      ccForHost = ccPrefixForStdenv pkgsBuildHost.targetPackages.stdenv;
      cxxForHost = cxxPrefixForStdenv pkgsBuildHost.targetPackages.stdenv;
      ccForTarget = ccPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv;
      cxxForTarget = cxxPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv;
I recall there being more of xPkgs.targetPackages in nixpkgs
23:43:06
@artturin:matrix.orgArtturin* I recall there being more of xPkgs.targetPackages.stdenv in nixpkgs23:44:30
22 Aug 2025
@corridor4572:matrix.orgRichInOverdraft joined the room.00:43:13
@emilazy:matrix.orgemilybut... is it wrong? :)10:57:33
@emilazy:matrix.orgemilyit seems like it's accessing earlier bootstrap stages in some cases, maybe.10:57:50
@dramforever:matrix.orgdramforever targetPackages.stdenv is okay i think 10:59:21
@dramforever:matrix.orgdramforeverit's like the one package that's okay to get from targetPackages10:59:40
@dramforever:matrix.orgdramforeveras of whether the mapping to ccFor* tbh idfk10:59:58
@dramforever:matrix.orgdramforever * as of whether the mapping to ccFor* is correct tbh idfk 11:00:06
@emilazy:matrix.orgemily

honestly I guess it's more likely one of these things

    ++
      optional
        (stdenv.hostPlatform.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && useLLVM)
        "--push-state --as-needed -L${llvmPackages.libcxx}/lib -lc++ -lc++abi -lLLVM-${lib.versions.major llvmPackages.llvm.version} --pop-state"
    ++ optional (stdenv.hostPlatform.isDarwin && !withBundledLLVM) "-lc++ -lc++abi"
    ++ optional stdenv.hostPlatform.isFreeBSD "-rpath ${llvmPackages.libunwind}/lib"
  ++ optional (useLLVM && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD) [
    llvmPackages.libunwind
    # Hack which is used upstream https://github.com/gentoo/gentoo/blob/master/dev-lang/rust/rust-1.78.0.ebuild#L284
    (runCommandLocal "libunwind-libgcc" { } ''
      mkdir -p $out/lib
      ln -s ${llvmPackages.libunwind}/lib/libunwind.so $out/lib/libgcc_s.so
      ln -s ${llvmPackages.libunwind}/lib/libunwind.so $out/lib/libgcc_s.so.1
    '')
  ];
11:08:51
@emilazy:matrix.orgemily since the hack that "fixes" it just involves overriding llvmPackages 11:09:00
@emilazy:matrix.orgemily so leaning more towards "llvmPackages wire-up is busted", as I've observed that myself 11:09:14
@limwa:matrix.orgAndré Lima joined the room.15:07:26
@elikoga:matrix.orgelikoga changed their profile picture.17:27:46
23 Aug 2025
@limwa:matrix.orgAndré Lima Any tips on cross-compiling a package out-of-tree with a compiler that's also built out-of-tree? I was looking into mkScopeWithSplicing', but I'm not sure how to use it outside of the Nixpkgs repository.
The concrete goal I'm trying to achieve is 1. compile a specific revision of LLVM that's used by Polygeist and 2. be able to use the clang compiler with the libc provided by that revision to cross-compile programs to another architecture. Any help is appreciated 🙏
22:37:19
24 Aug 2025
@corridor4572:matrix.orgRichInOverdraft changed their display name from Richman to rich.04:10:44
@artturin:matrix.orgArtturinWith overlays12:22:57
@artturin:matrix.orgArtturin* With a overlay12:23:14

Show newer messages


Back to Room ListRoom Version: 6