Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link error on aarch64 #329

Closed
SparrowLii opened this issue Dec 6, 2021 · 1 comment
Closed

Link error on aarch64 #329

SparrowLii opened this issue Dec 6, 2021 · 1 comment

Comments

@SparrowLii
Copy link

SparrowLii commented Dec 6, 2021

My Cargo.toml:

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

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

My main.rs:

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

My Xargo.toml:

[dependencies.std]
stage = 2

And when I run xargo build --release --target=aarch64-unknown-linux-gnu, it fault with:

   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-65dedcf1a56c19ff.untitled1.cd53ad71-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/.xargo/HOST/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,--end-group" "-Wl,-Bstatic" "/root/.xargo/HOST/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-0549068cc816ada1.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/root/.xargo/HOST/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs"
  = note: /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff.untitled1.cd53ad71-cgu.0.rcgu.o: In function `main':
          untitled1.cd53ad71-cgu.0:(.text.main+0x574): undefined reference to `__aarch64_ldadd8_rel'
          /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff.untitled1.cd53ad71-cgu.0.rcgu.o: In function `std::thread::current':
          untitled1.cd53ad71-cgu.0:(.text._ZN3std6thread7current17h8875f1997c00dfceE+0x94): undefined reference to `__aarch64_ldadd8_relax'
          /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff.untitled1.cd53ad71-cgu.0.rcgu.o: In function `std::sys_common::thread_info::THREAD_INFO::__getit::destroy':
          untitled1.cd53ad71-cgu.0:(.text._ZN3std10sys_common11thread_info11THREAD_INFO7__getit7destroy17h75e88f60ab7c870eE+0x30): undefined reference to `__aarch64_ldadd8_rel'
          /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff.untitled1.cd53ad71-cgu.0.rcgu.o: In function `std::panicking::rust_panic_with_hook':
          untitled1.cd53ad71-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17hcbdc16408d196971E+0x34): undefined reference to `__aarch64_ldadd8_relax'
          untitled1.cd53ad71-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17hcbdc16408d196971E+0x218): undefined reference to `__aarch64_ldadd8_relax'
          untitled1.cd53ad71-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17hcbdc16408d196971E+0x5f0): undefined reference to `__aarch64_ldadd8_relax'
          untitled1.cd53ad71-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17hcbdc16408d196971E+0x6d8): undefined reference to `__aarch64_ldadd8_rel'
          untitled1.cd53ad71-cgu.0:(.text._ZN3std9panicking20rust_panic_with_hook17hcbdc16408d196971E+0x6f8): undefined reference to `__aarch64_ldadd8_relax'
          /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff.untitled1.cd53ad71-cgu.0.rcgu.o: In function `alloc::sync::Arc<T>::drop_slow':
          untitled1.cd53ad71-cgu.0:(.text._ZN5alloc4sync12Arc$LT$T$GT$9drop_slow17hed7f2db05f2ab185E+0x34): undefined reference to `__aarch64_ldadd8_rel'
          /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff.untitled1.cd53ad71-cgu.0.rcgu.o: In function `std::sys_common::thread_local_key::StaticKey::lazy_init':
          untitled1.cd53ad71-cgu.0:(.text._ZN3std10sys_common16thread_local_key9StaticKey9lazy_init17h7c8dd114f0263e40E+0x68): undefined reference to `__aarch64_cas8_acq_rel'
          /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff.untitled1.cd53ad71-cgu.0.rcgu.o: In function `std::sync::once::Once::call_inner':
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x80): undefined reference to `__aarch64_cas8_acq'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x1f8): undefined reference to `__aarch64_ldadd8_relax'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x230): undefined reference to `__aarch64_cas8_rel'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x24c): undefined reference to `__aarch64_ldadd8_rel'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x374): undefined reference to `__aarch64_ldadd8_relax'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x3a0): undefined reference to `__aarch64_ldadd4_acq'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x3d0): undefined reference to `__aarch64_cas4_acq'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x3e4): undefined reference to `__aarch64_ldadd8_rel'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x418): undefined reference to `__aarch64_ldadd8_rel'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x46c): undefined reference to `__aarch64_swp8_acq_rel'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x4b8): undefined reference to `__aarch64_swp4_rel'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x4cc): undefined reference to `__aarch64_ldadd8_rel'
          untitled1.cd53ad71-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h216c077ed7c4dd2dE+0x4f8): undefined reference to `__aarch64_ldadd8_rel'
          /home/liyuan/untitled1/target/aarch64-unknown-linux-gnu/release/deps/untitled1-65dedcf1a56c19ff.untitled1.cd53ad71-cgu.0.rcgu.o: In function `core::ptr::drop_in_place<std::thread::Thread>':
          untitled1.cd53ad71-cgu.0:(.text._ZN4core3ptr40drop_in_place$LT$std..thread..Thread$GT$17h0c50201822c51a71E+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

I wonder if it is because xargo has a problem on aarch64

@SparrowLii
Copy link
Author

This problem can currently be solved by adding the compilation parameter -Ctarget-feature=-outline-atomics, so I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant