Skip to content

Commit

Permalink
integration-test: Don't set rust-lld as a linker
Browse files Browse the repository at this point in the history
The recommendation (coming from rust-lang/rust#130062) is using C
compiler driver as a linker, which is able to find system-wide
libraries. Using linker binaries directly in `-C linker` (e.g.
`-C linker=rust-lld`) often results in errors like:

```
cargo:warning=error: linking with `rust-lld` failed: exit status: 1ger, ppv-lite86, libc...
cargo:warning=  |
cargo:warning=  = note: LC_ALL="C" PATH="/home/vadorovsky/.rustup/toolchains/stable-x86_64-un
cargo:warning=  = note: rust-lld: error: unable to find library -lgcc_s
cargo:warning=          rust-lld: error: unable to find library -lc
cargo:warning=
cargo:warning=
cargo:warning=
cargo:warning=error: aborting due to 1 previous error
```

Fixes aya-rs#907
  • Loading branch information
vadorovsky committed Oct 9, 2024
1 parent 1d272f3 commit bb6b2a9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions xtask/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ pub fn build<F>(target: Option<&str>, f: F) -> Result<Vec<(String, PathBuf)>>
where
F: FnOnce(&mut Command) -> &mut Command,
{
// Always use rust-lld and -Zbuild-std in case we're cross-compiling.
let mut cmd = Command::new("cargo");
cmd.args(["build", "--message-format=json"]);
if let Some(target) = target {
let config = format!("target.{target}.linker = \"rust-lld\"");
cmd.args(["--target", target, "--config", &config]);
cmd.args(["--target", target]);
}
f(&mut cmd);

Expand Down

0 comments on commit bb6b2a9

Please sign in to comment.