Skip to content

Cannot link build scripts when the path to the rust project contains a space when using flakes #258

@RustyNova016

Description

@RustyNova016

This is a pretty stupid issue but... If I put a space in the path to the rust project, it will fail to link some crates with CC. If I put it somewhere else without spaces, it works.

Steps to reproduce:
I got a few repos that behaves like that, so here's one in example:

git clone https://github.com/RustyNova016/musicbrainz_rs.git
nix develop
cargo test

If the path to the clone contains a space, it will error out:

error: could not compile `crc32fast` (build script) due to 1 previous error
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-m64" "/mnt/geario/File Storage/Documents/Programing/musicbrainz_rs/target/debug/build/rustversion-4a9b3f1922c18105/rustc8l1tns/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" "/mnt/geario/File Storage/Documents/Programing/musicbrainz_rs/target/debug/build/rustversion-4a9b3f1922c18105/rustc8l1tns/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" "/mnt/geario/File Storage/Documents/Programing/musicbrainz_rs/target/debug/build/rustversion-4a9b3f1922c18105/build_script_build-4a9b3f1922c18105" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: cannot open Storage/Documents/Programing/musicbrainz_rs/outputs/out/lib: No such file or directory
          collect2: error: ld returned 1 exit status

If the path doesn't contains a space, tests will run.

The flake file can be found here, but it's nearly identical to the one in the readme:
https://github.com/RustyNova016/musicbrainz_rs/blob/7b79e2a70a83043fe3012a9bbfbb9338404c3817/flake.nix

Please note that it doesn't happen when rust is installed on the the nixos system directly, so this must be something with the overlay?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions