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"
Set an environment variable in Rust You can set an environment variable (for the scope of the currently running process) using the standard library too. To do so, we use env::set_var(key, value) .
To set an environment variable, use the command " export varname=value ", which sets the variable and exports it to the global environment (available to other processes). Enclosed the value with double quotes if it contains spaces. To set a local variable, use the command " varname =value " (or " set varname =value ").
.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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With