Help building the compiler on NixOS

I'm not sure if this question is better suited to here or the internals forum (or even the nix forum :grin: ).

I'm trying to run tests on the compiler after making a change on NixOS, but some of them are failing with linking errors.

I'm using home manager to provide rustup, gcc, llvmPackages.bintools-unwrapped, cmake and python, since there's no flake.nix/shell.nix in the Rust repo.

I'm wondering if anyone else regularly builds/tests the compiler on NixOS and has a config they could share? Googling hasn't yielded much :confused: .

The relevant part of the error seems to be:

   = note: /nix/store/rq6bh3qfrqnyqwik0w3q6w180zg3w2pa-binutils-2.38/bin/ld: cannot find -lutil: No such file or directory
           /nix/store/rq6bh3qfrqnyqwik0w3q6w180zg3w2pa-binutils-2.38/bin/ld: cannot find -lrt: No such file or directory
           /nix/store/rq6bh3qfrqnyqwik0w3q6w180zg3w2pa-binutils-2.38/bin/ld: cannot find -lpthread: No such file or directory
           /nix/store/rq6bh3qfrqnyqwik0w3q6w180zg3w2pa-binutils-2.38/bin/ld: cannot find -lm: No such file or directory
           /nix/store/rq6bh3qfrqnyqwik0w3q6w180zg3w2pa-binutils-2.38/bin/ld: cannot find -ldl: No such file or directory
           /nix/store/rq6bh3qfrqnyqwik0w3q6w180zg3w2pa-binutils-2.38/bin/ld: cannot find -lc: No such file or directory
           collect2: error: ld returned 1 exit status

which suggests that various native libraries are missing, but I'm not sure if anyone has a config that provides these libs?

Thanks :grin:

This is NOT tested:

Rust - NixOS Wiki , under section "Unofficial Overlays", has links to Flake support. Do any of those work for you?

Hmm, these look like they're for building rust code with an existing rustc (unless I'm missing something). I managed to get past this issue by adding pkgs.glibc.static to nativeBuildDependencies, but that's now complaining about circular dependencies (e.g. for memcpy)

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.