Skip to content

cross picking up wrong target options in cargos config.toml #621

Open
@oliverbestmann

Description

@oliverbestmann

I've added a [target.target.x86_64-unknown-linux-gnu] section to my $HOME/.cargo/config.toml. If i am now using cross to compile for a different target, say cross build --target aarch64-unknown-linux-gnu, the build picks up the config for x86_64-unknown-linux-gnu.

In my case, i've configured

oliver@machine ~> /bin/cat ~/.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = [
  "-C", "target-cpu=native",
  "-C", "link-arg=-fuse-ld=/home/oliver/.local/bin/mold"
]

And the build fails with

oliver@machine ~> cross build --target aarch64-unknown-linux-gnu --release
info: syncing channel updates for '1.56.0-x86_64-unknown-linux-gnu'
  1.56.0-x86_64-unknown-linux-gnu unchanged - rustc 1.56.0 (09c42c458 2021-10-18)
error: linker `/usr/bin/clang` not found
  |
  = note: No such file or directory (os error 2)

doesn't work with rust 1.57.0 either.
cross version 0.2.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions