cargo-ndk
cargo-ndk copied to clipboard
When custom cargo profile is specified ndk tries to copy from invalid directory
Hello, first of all thanks for amazing project! I wanted to hug you all after hitting the ndk and gcc linking issue... <3
I've found the problem when trying to use cargo's custom profiles. The output directory changes and I get the following error after successful compilation:
2022-08-08T11:08:52Z INFO cargo_ndk::cli] Copying libraries to ./target/jniLibs...
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/username/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-ndk-2.11.0/src/cli.rs:343:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
To reproduce one should create custom profile in Cargo.toml:
[profile.release-space-optimized]
inherits = "release"
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
lto = true # Enable link time optimization
codegen-units = 1 # Reduce parallel code generation units
panic = "abort"
And call cli interface while specifying custom profile:
cargo ndk \
-t armeabi-v7a \
-t arm64-v8a \
-o ./target/jniLibs build --profile release-space-optimized
cargo will output files to directory: target/triple/{name_of_the_profile}
I won't have time to look into this for quite a while, but the codebase is quite small. Feel free to have a poke and make a PR if you manage to fix it. :)
Thanks for responding. It's crazy time for me to but I will definitely try to find time! 👌
śr., 10 sie 2022, 21:21 użytkownik Brendan Molloy @.***> napisał:
I won't have time to look into this for quite a while, but the codebase is quite small. Feel free to have a poke and make a PR if you manage to fix it. :)
— Reply to this email directly, view it on GitHub https://github.com/bbqsrc/cargo-ndk/issues/73#issuecomment-1211157835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA767CDK34KQU2Y63DJCHP3VYP6MLANCNFSM5544HSJQ . You are receiving this because you authored the thread.Message ID: @.***>
This is fixed in 2.12.1
.