Skip to content

cross 0.2.4 failed to compile detect-wasi on aarch64-unknown-linux-gnu #1067

@NobodyXu

Description

@NobodyXu

Checklist

Describe your issue

Running cmd

cross build --target aarch64-unknown-linux-gnu --profile release --no-default-features --features zlib-ng,static,rustls,trust-dns,fancy-no-backtrace,log_release_max_level_debug -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort

on cargo-binstall v0.15.0 failed with error:

  = note: /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::thread::local::fast::Key$LT$T$GT$::try_initialize::hd96642440da283f9':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std6thread5local4fast12Key$LT$T$GT$14try_initialize17hd96642440da283f9E+0xe0): undefined reference to `__aarch64_ldadd8_rel'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sync::once::Once::call_inner::h060aa2b0d3f5a68e':
          detect_wasi.a3009cc8-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h060aa2b0d3f5a68eE+0x80): undefined reference to `__aarch64_cas8_rel'
          detect_wasi.a3009cc8-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h060aa2b0d3f5a68eE+0xb4): undefined reference to `__aarch64_ldadd4_acq'
          detect_wasi.a3009cc8-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h060aa2b0d3f5a68eE+0xd8): undefined reference to `__aarch64_cas4_acq'
          detect_wasi.a3009cc8-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h060aa2b0d3f5a68eE+0x114): undefined reference to `__aarch64_cas8_acq'
          detect_wasi.a3009cc8-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h060aa2b0d3f5a68eE+0x14c): undefined reference to `__aarch64_swp8_acq_rel'
          detect_wasi.a3009cc8-cgu.0:(.text.unlikely._ZN3std4sync4once4Once10call_inner17h060aa2b0d3f5a68eE+0x18c): undefined reference to `__aarch64_swp4_rel'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::thread::current::h6376ef4dd963a383':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std6thread7current17h6376ef4dd963a383E+0x54): undefined reference to `__aarch64_ldadd8_relax'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::thread::Thread::new::h83b0ac90303c4f44':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std6thread6Thread3new17h83b0ac90303c4f44E+0x9c): undefined reference to `__aarch64_cas8_relax'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sys_common::thread_local_key::StaticKey::key::h23535b24a0a27e8e':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std10sys_common16thread_local_key9StaticKey3key17h23535b24a0a27e8eE+0x58): undefined reference to `__aarch64_cas8_acq_rel'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sync::once::Once::call_once::_$u7b$$u7b$closure$u7d$$u7d$::he53d694758cb088e':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std4sync4once4Once9call_once28_$u7b$$u7b$closure$u7d$$u7d$17he53d694758cb088eE+0x88): undefined reference to `__aarch64_cas4_acq'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sys::unix::locks::futex_mutex::Mutex::unlock::haa69c46c5ac213ae':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std3sys4unix5locks11futex_mutex5Mutex6unlock17haa69c46c5ac213aeE+0x10): undefined reference to `__aarch64_swp4_rel'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sys::unix::locks::futex_mutex::Mutex::lock::h6e75f17ed18423bc':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std3sys4unix5locks11futex_mutex5Mutex4lock17h6e75f17ed18423bcE+0x58): undefined reference to `__aarch64_swp4_acq'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sys::unix::os::env_read_lock::hdf4a0560f8167376':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std3sys4unix2os13env_read_lock17hdf4a0560f8167376E+0x38): undefined reference to `__aarch64_cas4_acq'
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std3sys4unix2os13env_read_lock17hdf4a0560f8167376E+0x8c): undefined reference to `__aarch64_cas4_acq'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sys_common::rwlock::MovableRwLock::read_unlock::h6a75b81985194117':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std10sys_common6rwlock13MovableRwLock11read_unlock17h6a75b81985194117E+0x10): undefined reference to `__aarch64_ldadd4_rel'
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std10sys_common6rwlock13MovableRwLock11read_unlock17h6a75b81985194117E+0xac): undefined reference to `__aarch64_cas4_relax'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sys::unix::locks::futex_rwlock::RwLock::wake_writer::h895883f366df70bd':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std3sys4unix5locks12futex_rwlock6RwLock11wake_writer17h895883f366df70bdE+0x10): undefined reference to `__aarch64_ldadd4_rel'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::process::Command::output::h701327146e947caf':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std7process7Command6output17h701327146e947cafE+0x15d4): undefined reference to `__aarch64_ldset8_relax'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `std::sys::unix::fs::remove_dir_impl::remove_dir_all_recursive::h93d2e878300c4293':
          detect_wasi.a3009cc8-cgu.0:(.text._ZN3std3sys4unix2fs15remove_dir_impl24remove_dir_all_recursive17h93d2e878300c4293E+0xf8): undefined reference to `__aarch64_ldadd8_relax'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `OUTLINED_FUNCTION_41':
          detect_wasi.a3009cc8-cgu.0:(.text.OUTLINED_FUNCTION_41+0x4): undefined reference to `__aarch64_ldadd8_rel'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `OUTLINED_FUNCTION_55':
          detect_wasi.a3009cc8-cgu.0:(.text.OUTLINED_FUNCTION_55+0x8): undefined reference to `__aarch64_cas4_acq'
          /target/aarch64-unknown-linux-gnu/release/deps/detect_wasi-c76bdb245350245c.detect_wasi.a3009cc8-cgu.0.rcgu.o: In function `OUTLINED_FUNCTION_71':
          detect_wasi.a3009cc8-cgu.0:(.text.OUTLINED_FUNCTION_71+0x4): undefined reference to `__aarch64_cas4_relax'
          collect2: error: ld returned 1 exit status

The error originates from std lib synchronization APIs (thread key, mutex, rwlock Once), std::thread::Thead::new, std::process::Command::output and std::sys::unix::fs::remove_dir_impl::remove_dir_all_recursive.

This might be related to #1066

I've tried setting export RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc" according to https://github.com/cross-rs/cross/wiki/FAQ#undefined-reference-with-build-std but still doesn't work.

Compiling cargo-binstall worked before #1046

What target(s) are you cross-compiling for?

aarch64-unknown-linux-gnu

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.4

Example

No response

Additional information / notes

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions