I need pass to linker args,
i put in my ~/.cargo/config:
[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc -Xlinker -rpath=/usr/lib/arm-linux-gnueabihf"
```
i get error:
```
error: could not exec the linker `/home/chessnokov/arm-linux-gnueabihf-gcc -Xlinker -rpath=/usr/lib/arm-linux-gnueabihf`: No such file or directory
```
then try:
[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc "-Xlinker" "-rpath=/usr/lib/arm-linux-gnueabihf""
same error
Sorry for bringing this to the top but, since it shows up on Google, I think it merits at least one answer:
Cargo and the TOML language aren't as loose about the difference between a string and a list as shell scripting is. If you actually used the ["array", "syntax"]
, you'd have gotten an error from Cargo about how it expected a string.
I've checked the docs and can't find any evidence that adding custom arguments is supported directly, so you'll have to write a simple wrapper script like this and then point ~/.cargo/config
at that instead.
#!/bin/sh
exec arm-linux-gnueabihf-gcc -Xlinker -rpath=/usr/lib/arm-linux-gnueabihf "$@"
1 Like
~/.cargo/config:
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
rustflags = ["-Clink-args=-Xlinker -rpath=/usr/lib/arm-linux-gnueabihf"]
1 Like