Closed randrievskiy closed 1 year ago
libgcc is no longer in the Android ndk, since r23.
How are you building harfbuzz and linking with it I wonder? I'm wondering if you're using any pre-built binaries that maybe need to be recompiled with a newer ndk toolchain so they don't try to pull in libgcc.
It seems like you need to track down which crate / library is trying to link against libgcc.
It used to be that the Rust stdlib binaries distributed with the rust compiler linked against libgcc and so tools like cargo-ndk used to implement workaround for redirecting the linker to link with libunwind instead of libgcc but that shouldn't generally be necessary any more.
As a workaround though maybe you could experiment with installing cargo-ndk 2
which used to implement the libgcc -> libunwind workaround: https://github.com/bbqsrc/cargo-ndk/pull/67
We're using Bindgen
bindgen::Builder::default()
.header("packages/harfbuzz_deps.h") // #include https://github.com/harfbuzz/harfbuzz/blob/main/src/hb.h
.clang_arg("-fvisibility=default")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.expect("Unable to generate bindings");
but how are you compiling the harfbuzz library itself which is written in C++ from what I recall. I guess you maybe either have a pre-built binary for harfbuzz or maybe a build.rs that cross compiles via autotools.
If you're building a .so
for harfbuzz then you could try using objdump
or readelf
to check the list of dependencies that the library has and double check that doesn't include libgcc.so
Yes, we have a build.rs and we're compiling with Meson
okey yeah.
can you maybe try running
readelf -d path/to/libharfbuzz.so | grep 'NEEDED'
and see if it needs libgcc.so
If so then I guess you may need to look at how the meson build is done.
Okay, I've found a solution to my issue. I forgot to add a cross-file for the Meson. Thank you for your time!
We've encountered an Issue:
We need to link Rust code with Harfbuzz and run it on Android. Bindings are in the separate Cargo module.
We've already googled a lot and tried a bunch of workarounds(e.g., add libgcc.a files, build with NDKs lower than 25). Unfortunately, nothing helps( Hope you can help us solve this)
cargo-ndk - 3.2.0 Android NDK - 25.2.9519653 Rust version - 1.73.0-nightly (da6b55cc5 2023-07-17)
Building with command:
Cargo.toml