Closed yiv closed 3 years ago
the --hash-style
option is not related to Cargo specifically .. nor Rust .. it something related to the linker you are using in most cases I guess it is ld
so what I suggest is adding .cargo/config.toml
file to your code (in the root of the project) with options to customize/add linker options.
in this case, you need to add --hash-style=both
option in android
targets.
something like this code should work:
[target.aarch64-linux-android]
rustflags = ["-C", "link-arg=--hash-style=both"]
[target.x86_64-linux-android]
rustflags = ["-C", "link-arg=--hash-style=both"]
not test :D
feel free to add more targets
if it worked (but yeah you got the idea).
Thanks a lot, after adding lines like below, Error of empty/missing DT_HASH has been fixed.
[target.aarch64-linux-android]
rustflags = ["-C", "link-arg=-Wl,--hash-style=both"]
[target.armv7-linux-androideabi]
rustflags = ["-C", "link-arg=-Wl,--hash-style=both"]
[target.i686-linux-android]
rustflags = ["-C", "link-arg=-Wl,--hash-style=both"]
[target.x86_64-linux-android]
rustflags = ["-C", "link-arg=-Wl,--hash-style=both"]
Android 5.1.1 ( API level 22)
DT_GNU_HASH is availible in API level >= 23, before that only DT_HASH was been supported. And the output of Rust set the default symbol lookup hash style to GNU_HASH which unsupported on old device of API level 22 and below. Some topics recommand set --hash-style=both, I have been trying hard to find how to do this with cargo.