Skip to content

undefined reference errors on aarch64 #74

Closed
rust-lang/rust
#113269

Description

My main.rs:

fn main() {
    println!("Hello, world!");
}

My Cargo.toml:

[package]
name = "untitled1"
version = "0.1.0"
edition = "2021"

[dependencies]

[profile.dev]
panic = "abort"

[profile.release]
lto = true
codegen-units = 1
panic = "abort"

My rust version:

rustc 1.58.0-nightly (18bc4bee9 2021-11-02)
binary: rustc
commit-hash: 18bc4bee9710b181b440a472635150f0d6257713
commit-date: 2021-11-02
host: aarch64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0

My cargo version:

cargo 1.58.0-nightly (94ca096af 2021-10-29)

And when I run cargo +nightly build -Z build-std=std,panic_abort --target aarch64-unknown-linux-gnu --release, it failed as following:

Compiling untitled1 v0.1.0 (/home/liyuan/untitled1)
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps" "-L" "/home/liyuan/untitled1/target/release/deps" "-L" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,--end-group" "-Wl,-Bstatic" "/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/libcompiler_builtins-b1c09b11534f431a.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/root/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs"
= note: /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `main':
untitled1.a81abd85-cgu.0:(.text.main+0x584): undefined reference to `__aarch64_ldadd8_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `std::thread::current':
untitled1.a81abd85-cgu.0:(.text._ZN3std6thread7current17hcadb8da67f75b371E+0x94): undefined reference to `__aarch64_ldadd8_relax'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `std::sys_common::thread_info::THREAD_INFO::__getit::destroy':
untitled1.a81abd85-cgu.0:(.text._ZN3std10sys_common11thread_info11THREAD_INFO7__getit7destroy17hc88165896c9c7150E+0x30): undefined reference to `__aarch64_ldadd8_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `std::panicking::rust_panic_with_hook':
untitled1.a81abd85-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17h33f06dd76800d30eE+0x38): undefined reference to `__aarch64_ldadd8_relax'
untitled1.a81abd85-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17h33f06dd76800d30eE+0x21c): undefined reference to `__aarch64_ldadd8_relax'
untitled1.a81abd85-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17h33f06dd76800d30eE+0x470): undefined reference to `__aarch64_ldadd8_relax'
untitled1.a81abd85-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17h33f06dd76800d30eE+0x5e4): undefined reference to `__aarch64_swp1_acq_rel'
untitled1.a81abd85-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17h33f06dd76800d30eE+0x808): undefined reference to `__aarch64_ldadd8_rel'
untitled1.a81abd85-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17h33f06dd76800d30eE+0x828): undefined reference to `__aarch64_ldadd8_relax'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `std::sys::unix::os::getenv':
untitled1.a81abd85-cgu.0:(.text._ZN3std3sys4unix2os6getenv17h637ec447b7777c5dE+0xf4): undefined reference to `__aarch64_ldadd8_relax'
untitled1.a81abd85-cgu.0:(.text._ZN3std3sys4unix2os6getenv17h637ec447b7777c5dE+0x164): undefined reference to `__aarch64_ldadd8_relax'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `alloc::sync::Arc<T>::drop_slow':
untitled1.a81abd85-cgu.0:(.text._ZN5alloc4sync12Arc$LT$T$GT$9drop_slow17h0b382be5746a13ddE+0x34): undefined reference to `__aarch64_ldadd8_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `core::ptr::drop_in_place<std::backtrace_rs::symbolize::gimli::Mapping>':
untitled1.a81abd85-cgu.0:(.text._ZN4core3ptr65drop_in_place$LT$std..backtrace_rs..symbolize..gimli..Mapping$GT$17he792609af40a5799E+0x3c): undefined reference to `__aarch64_ldadd8_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `std::backtrace_rs::symbolize::gimli::Context::new':
untitled1.a81abd85-cgu.0:(.text._ZN3std12backtrace_rs9symbolize5gimli7Context3new17h1cd0c0cb82efaeddE+0x6ec): undefined reference to `__aarch64_ldadd8_relax'
untitled1.a81abd85-cgu.0:(.text._ZN3std12backtrace_rs9symbolize5gimli7Context3new17h1cd0c0cb82efaeddE+0x73c): undefined reference to `__aarch64_ldadd8_rel'
untitled1.a81abd85-cgu.0:(.text._ZN3std12backtrace_rs9symbolize5gimli7Context3new17h1cd0c0cb82efaeddE+0x844): undefined reference to `__aarch64_ldadd8_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `addr2line::ResDwarf<R>::parse':
untitled1.a81abd85-cgu.0:(.text._ZN9addr2line17ResDwarf$LT$R$GT$5parse17h34982b0f66c65899E+0x43a4): undefined reference to `__aarch64_ldadd8_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `alloc::sync::Arc<T>::drop_slow':
untitled1.a81abd85-cgu.0:(.text._ZN5alloc4sync12Arc$LT$T$GT$9drop_slow17hcf08a91070e3189aE+0x1c): undefined reference to `__aarch64_ldadd8_rel'
untitled1.a81abd85-cgu.0:(.text._ZN5alloc4sync12Arc$LT$T$GT$9drop_slow17hcf08a91070e3189aE+0x48): undefined reference to `__aarch64_ldadd8_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o:untitled1.a81abd85-cgu.0:(.text._ZN4core3ptr149drop_in_place$LT$alloc..boxed..Box$LT$addr2line..ResDwarf$LT$gimli..read..endian_slice..EndianSlice$LT$gimli..endianity..LittleEndian$GT$$GT$$GT$$GT$17h0e1366d15b11f48fE+0x40): more undefined references to `__aarch64_ldadd8_rel' follow
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `std::sys_common::thread_local_key::StaticKey::lazy_init':
untitled1.a81abd85-cgu.0:(.text._ZN3std10sys_common16thread_local_key9StaticKey9lazy_init17h00558e98e3620b2eE+0x68): undefined reference to `__aarch64_cas8_acq_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `std::sync::once::Once::call_inner':
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x80): undefined reference to `__aarch64_cas8_acq'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x1f8): undefined reference to `__aarch64_ldadd8_relax'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x230): undefined reference to `__aarch64_cas8_rel'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x24c): undefined reference to `__aarch64_ldadd8_rel'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x374): undefined reference to `__aarch64_ldadd8_relax'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x3a0): undefined reference to `__aarch64_ldadd4_acq'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x3d0): undefined reference to `__aarch64_cas4_acq'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x3e4): undefined reference to `__aarch64_ldadd8_rel'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x418): undefined reference to `__aarch64_ldadd8_rel'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x46c): undefined reference to `__aarch64_swp8_acq_rel'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x4b8): undefined reference to `__aarch64_swp4_rel'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x4cc): undefined reference to `__aarch64_ldadd8_rel'
untitled1.a81abd85-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h1ad0eb23ff315876E+0x4f8): undefined reference to `__aarch64_ldadd8_rel'
/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-0800db29db292089.untitled1.a81abd85-cgu.0.rcgu.o: In function `core::ptr::drop_in_place<std::thread::Thread>':
untitled1.a81abd85-cgu.0:(.text._ZN4core3ptr40drop_in_place$LT$std..thread..Thread$GT$17h24d04784a5e3917cE+0x10): undefined reference to `__aarch64_ldadd8_rel'
collect2: error: ld returned 1 exit status

= help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `untitled1` due to previous error

Is this because the build-std tool does not support aarch64?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    S-needs-investigationStatus: needs investigationstabilization blockerThis needs a resolution before stabilizationupstreamAn issue with the standard library itself or its dependencies.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions