Rust LLD execv: Argument list too long

Hi, I hit a strange limitation when trying to use lld on a rust project:

note: gcc: fatal error: cannot execute '/nix/store/v819nrv8d33ns36gm4v9vqydq1v95axi-gcc-10.3.0/libexec/gcc/x86_64-unknown-linux-gnu/10.3.0/collect2': execv: Argument list too long
          compilation terminated.

Is there a known workaround ?

where is this rust project, so i can reproduce.

Sadly I cannot share this repo

Maybe I can provide you enough information by an other way ?

This may be related to this long-standing issue: GCC fails because argument list created by nix is too long · Issue #41340 · NixOS/nixpkgs · GitHub

2 Likes

Is there something I can do to prevent this from happening ?

Some commands that accept and expect many args can read them from a file. It appears that gcc will also do this with an @argsfile arg:

I guess this would work around the argument limit, but I’m not sure how exactly this would be utilized in a nix environment.

Edit: it seems this is called a “response file” and it doesn’t necessarily fix the underlying issue according to the link posted earlier. So maybe nevermind.

Hosted by Flying Circus.