I’m trying to follow A Minimal Rust Kernel | Writing an OS in Rust to get started on a project. Once the author has configured unstable.build-std, it builds for him, but I get:
> cargo build --target target.json
Compiling compiler_builtins v0.1.160 (/home/alice/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins)
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/home/alice/os/target/debug/build/compiler_builtins-7d15b2f6d23c3780/rustcfCZrSx/symbols.o" "<3 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/home/alice/os/target/debug/build/compiler_builtins-7d15b2f6d23c3780/rustcfCZrSx/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/alice/os/target/debug/build/compiler_builtins-7d15b2f6d23c3780/build_script_build-7d15b2f6d23c3780" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: /home/alice/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/ld.lld: line 5: /nix/store/9q0ah902348jm3y4v4m975sia92lmb8h-rustup-1.28.2/nix-support/ld-wrapper.sh: No such file or directory
collect2: error: ld returned 127 exit status
error: could not compile `compiler_builtins` (build script) due to 1 previous error
I can’t find any information online about what ld-wrapper.sh or its purpose is, so I don’t really know what to do here. Does anybody else know? Maybe it’s a simple case of a missing package. The only relevant packages I have are pkgs.clang and pkgs.rustup. I still get the error if I install separately pkgs.lld or pkgs.llvmPackages.bintools, or if I replace pkgs.clang with pkgs.clang.cc.