10

I'm using .cargo/config like this

[target.arm-linux-androideabi] linker = "/home/rico/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc" 

But /home/rico/android-ndk-r13b is my NDK_HOME, not NDK_HOME of everyone

How can I specify to use $NDK_HOME?

Something like:

[target.arm-linux-androideabi] linker = "$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc" 

1 Answer 1

8

.cargo/config doesn't support environment variables. But you can configure the linker with RUSTC_LINKER environment variable:

export RUSTC_LINKER="$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc" cargo build # will try to use NDK's linker now 

Though it'll work for all targets, not only for arm-linux-androideabi.

Sign up to request clarification or add additional context in comments.

2 Comments

Any idea whether .cargo/config supports home directory (having difficulties finding this, probably not).
@lxx nope, as far as I know

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.