forked from gnzlbg/jemallocator
-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Description
Problems encountered
Compile aarch64-linux-android binary on linux.
Specify profile as release, and it will compile normally.
However, if lto = "thin" is specified, an error will be reported. The details are as follows:
= note: ld.lld: error: duplicate symbol: pthread_atfork
>>> defined at crtbegin.c
>>> /home/fys/soft/ndk/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/23/crtbegin_dynamic.o:(pthread_atfork)
>>> defined at build_jemalloc.6cd863fbc26b10-cgu.0
>>> /home/fys/source/build_jemalloc/target/aarch64-linux-android/nightly/deps/build_jemalloc-c1434931e7fc5ee2.build_jemalloc.6cd863fbc26b10-cgu.0.rcgu.o:(.text.pthread_atfork+0x0)
clang-17: error: linker command failed with exit code 1 (use -v to see invocation)
How to reproduce
main.rs
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
fn main() {
println!("Hello, world!");
}Cargo.toml
[package]
name = "build_jemalloc"
version = "0.1.0"
edition = "2021"
[dependencies]
tikv-jemallocator = "0.5"
[profile.nightly]
inherits = "release"
lto = true- Install android ndk, and set the
ANDROID_NDK_HOMEenvironment variable. cargo ndk --platform 23 -t aarch64-linux-android build --profile releaseis ok.cargo ndk --platform 23 -t aarch64-linux-android build --profile nightlyis wrong.
I tried removing this part of the code and it works fine.
Metadata
Metadata
Assignees
Labels
No labels