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

Error when building for armv6 #719

Open
octavonce opened this issue Apr 5, 2023 · 17 comments
Open

Error when building for armv6 #719

octavonce opened this issue Apr 5, 2023 · 17 comments

Comments

@octavonce
Copy link

Forwarding this issue. Original is here: purpleprotocol/mimalloc_rust#91

This is the build error:

#0 331.7 error: linking with `arm-linux-gnueabihf-ld` failed: exit status: 1
#0 331.7   |
#0 331.7   = note: LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "arm-linux-gnueabihf-ld" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crti.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustcTnL0FL/symbols.o" "/build/target/arm-unknown-linux-musleabihf/release_optimized/deps/atrium-9d7c42d4a7254134.atrium.436a5141-cgu.0.rcgu.o" "--as-needed" "-L" "/build/target/arm-unknown-linux-musleabihf/release_optimized/deps" "-L" "/build/target/release_optimized/deps" "-L" "/build/target/arm-unknown-linux-musleabihf/release_optimized/build/ring-f953b60540da6b61/out" "-L" "/build/target/arm-unknown-linux-musleabihf/release_optimized/build/libmimalloc-sys-7044e007f4223565/out" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-Bstatic" "/tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib" "/tmp/rustcTnL0FL/libring-61e880a3b28c0c72.rlib" "-lunwind" "-lc" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcompiler_builtins-eb461ae3a10c4720.rlib" "-Bdynamic" "--eh-frame-hdr" "-znoexecstack" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained" "-o" "/build/target/arm-unknown-linux-musleabihf/release_optimized/deps/atrium-9d7c42d4a7254134" "--gc-sections" "-static" "-zrelro" "-znow" "-O1" "--strip-all" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtn.o"
#0 331.7   = note: arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `mi_stat_add.constprop.0':
#0 331.7           static.c:(.text.mi_stat_add.constprop.0+0x3c): undefined reference to `__atomic_fetch_add_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text.mi_stat_add.constprop.0+0x4c): undefined reference to `__atomic_fetch_add_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text.mi_stat_add.constprop.0+0x5c): undefined reference to `__atomic_fetch_add_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text.mi_stat_add.constprop.0+0x6c): undefined reference to `__atomic_fetch_add_8'
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `mi_stats_add.constprop.0':
#0 331.7           static.c:(.text.mi_stats_add.constprop.0+0xe4): undefined reference to `__atomic_fetch_add_8'
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o):static.c:(.text.mi_stats_add.constprop.0+0xf4): more undefined references to `__atomic_fetch_add_8' follow
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `_mi_stat_increase':
#0 331.7           static.c:(.text._mi_stat_increase+0xc0): undefined reference to `__atomic_load_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_increase+0xec): undefined reference to `__atomic_compare_exchange_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_increase+0x108): undefined reference to `__atomic_fetch_add_8'
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `_mi_stat_decrease':
#0 331.7           static.c:(.text._mi_stat_decrease+0xa8): undefined reference to `__atomic_fetch_add_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_decrease+0xd0): undefined reference to `__atomic_load_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_decrease+0xfc): undefined reference to `__atomic_compare_exchange_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_decrease+0x118): undefined reference to `__atomic_fetch_add_8'
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `mi_process_info':
#0 331.7           static.c:(.text.mi_process_info+0x60): undefined reference to `__atomic_load_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text.mi_process_info+0x70): undefined reference to `__atomic_load_8'
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `mi_segment_cache_purge.constprop.0':
#0 331.7           static.c:(.text.mi_segment_cache_purge.constprop.0+0xc4): undefined reference to `__atomic_load_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text.mi_segment_cache_purge.constprop.0+0x128): undefined reference to `__atomic_load_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text.mi_segment_cache_purge.constprop.0+0x17c): undefined reference to `__atomic_store_8'
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `mi_segment_cache_purge.constprop.1':
#0 331.7           static.c:(.text.mi_segment_cache_purge.constprop.1+0x70): undefined reference to `__atomic_load_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text.mi_segment_cache_purge.constprop.1+0xc0): undefined reference to `__atomic_load_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text.mi_segment_cache_purge.constprop.1+0x110): undefined reference to `__atomic_store_8'
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `mi_segment_cache_pop_ex':
#0 331.7           static.c:(.text.mi_segment_cache_pop_ex+0x118): undefined reference to `__atomic_store_8'
#0 331.7           arm-linux-gnueabihf-ld: /tmp/rustcTnL0FL/liblibmimalloc_sys-868a4ff9e7af301d.rlib(static.o): in function `_mi_segment_cache_push':
#0 331.7           static.c:(.text._mi_segment_cache_push+0xec): undefined reference to `__atomic_store_8'
#0 331.7           arm-linux-gnueabihf-ld: static.c:(.text._mi_segment_cache_push+0x23c): undefined reference to `__atomic_store_8'
#0 331.7           
#0 331.7   = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
#0 331.7   = note: use the `-l` flag to specify native libraries to link
#0 331.7   = 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)
@daanx
Copy link
Collaborator

daanx commented Apr 7, 2023

Ah, it looks like it cannot find the atomic functions?
Can you try to use the -DMI_USE_LIBATOMIC=ON flag to cmake to see if this solves the issue?

(the cmake should detect automatically if -latomic is needed but it seems to fail here? is it due to musl ?)

@octavonce
Copy link
Author

@nicolaspernoud

@nicolaspernoud
Copy link

nicolaspernoud commented Apr 7, 2023

I can try, where do I need to put the flag ? Somewhere in the cargo build command ?

@devnexen
Copy link
Contributor

devnexen commented Apr 7, 2023

if you mean the libmimalloc-sys/build.rs then yes.

@nicolaspernoud
Copy link

Well, that is very strange, as trying to isolate the problem gives another error... both for armv6 and arm64 (arm64 used to work).
Using that Dockerfile :

FROM rust:1.68
RUN rustup target add arm-unknown-linux-musleabihf
RUN apt update && apt install -y musl-tools musl-dev binutils-arm-linux-gnueabihf gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu libcap2-bin
RUN ln -s /usr/bin/arm-linux-gnueabihf-gcc /usr/bin/arm-linux-musleabihf-gcc
RUN ln -s /usr/bin/aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-musl-gcc

WORKDIR /build

COPY . .

RUN cargo build --release --target arm-unknown-linux-musleabihf

It works when building the Mimalloc Rust crate directly, but not when building the simplest example application with :

  • Cargo.toml :
[package]
name = "mimalloc_test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
mimalloc = "0.1"
  • main.rs :
use mimalloc::MiMalloc;

#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;

fn main() {
    let _s = String::from("TEST");
    println!("Hello, world!");
}

The error is then :

 > [8/8] RUN cargo build --release --target arm-unknown-linux-musleabihf:                                                      
#0 0.662     Updating crates.io index                                                                                          
#0 60.34  Downloading crates ...                                                                                               
#0 60.53   Downloaded mimalloc v0.1.36                                                                                         
#0 60.54   Downloaded cc v1.0.79                                                                                               
#0 60.55   Downloaded libc v0.2.141
#0 60.61   Downloaded libmimalloc-sys v0.1.32
#0 60.73    Compiling cc v1.0.79
#0 60.73    Compiling libc v0.2.141
#0 61.49    Compiling libmimalloc-sys v0.1.32
#0 64.25    Compiling mimalloc v0.1.36
#0 64.37    Compiling mimalloc_test v0.1.0 (/build)
#0 64.53 error: linking with `cc` failed: exit status: 1
#0 64.53   |
#0 64.53   = note: LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crti.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustcDVTz23/symbols.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.mimalloc_test.ec68869b-cgu.0.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.mimalloc_test.ec68869b-cgu.1.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.mimalloc_test.ec68869b-cgu.2.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.mimalloc_test.ec68869b-cgu.3.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.mimalloc_test.ec68869b-cgu.4.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.mimalloc_test.ec68869b-cgu.5.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.mimalloc_test.ec68869b-cgu.6.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.mimalloc_test.ec68869b-cgu.7.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567.5f9bw7r2pmjbtmj8.rcgu.o" "-Wl,--as-needed" "-L" "/build/target/arm-unknown-linux-musleabihf/release/deps" "-L" "/build/target/release/deps" "-L" "/build/target/arm-unknown-linux-musleabihf/release/build/libmimalloc-sys-b7fd4f6c2fed1648/out" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-Wl,-Bstatic" "/build/target/arm-unknown-linux-musleabihf/release/deps/libmimalloc-42b3f935fd55b22f.rlib" "/build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-f583ddf93b4852e5.rlib" "/build/target/arm-unknown-linux-musleabihf/release/deps/liblibc-8cbac95de92d3f8a.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd-156f4170e33b8df4.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libpanic_unwind-e270422b4fca28e3.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libobject-49cd4b382f505f9d.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libmemchr-eed355165f4866e0.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libaddr2line-7e4a417a98d3e1fb.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libgimli-19ab14456ef67ec3.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_demangle-94668fbad859bad0.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd_detect-ddbf1f9293a44a9c.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libhashbrown-fac09f5d7f857f6b.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libminiz_oxide-f840348d8fb3422c.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libadler-f7fa56e66eb13c9f.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_alloc-9cb6dfec2a561167.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libunwind-b9f2e553466d47cf.rlib" "-lunwind" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcfg_if-fc80282540c648fb.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liblibc-9f5698308f331dfe.rlib" "-lc" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liballoc-5cb9b7f1b32dd35b.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_core-b2b48d67f7264a3c.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcore-21361f74a01c8c9e.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcompiler_builtins-eb461ae3a10c4720.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained" "-o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-1028ca129bacc567" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtn.o"
#0 64.53   = note: /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 64.53           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 64.53           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 64.53           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 64.53           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 64.53           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 64.53           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 64.53           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 64.53           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: error adding symbols: file in wrong format
#0 64.53           collect2: error: ld returned 1 exit status
#0 64.53           
#0 64.53 
#0 64.53 error: could not compile `mimalloc_test` due to previous error
------
Dockerfile:11
--------------------
   9 |     COPY . .
  10 |     
  11 | >>> RUN cargo build --release --target arm-unknown-linux-musleabihf
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo build --release --target arm-unknown-linux-musleabihf" did not complete successfully: exit code: 101

@daanx
Copy link
Collaborator

daanx commented Apr 14, 2023

ah, that looks like a strange error; not sure if this comes from mimalloc?
It may have been resolved with pr #724 which may have caused a link error? (latest dev/dev-slice include this patch).

@nicolaspernoud
Copy link

Well, with forcing mimalloc to latest dev-slice, that gives the following error :

 > [8/8] RUN cargo build --release --target arm-unknown-linux-musleabihf:           
#0 0.603     Updating crates.io index                                               
#0 33.13  Downloading crates ...                                                    
#0 33.46   Downloaded cc v1.0.79                                                    
#0 33.96   Downloaded libc v0.2.141                                                 
#0 34.24    Compiling libc v0.2.141
#0 34.24    Compiling cc v1.0.79
#0 35.06    Compiling libmimalloc-sys v0.1.32 (/build/mimalloc_rust/libmimalloc-sys)
#0 38.03 warning: In file included from c_src/mimalloc/src/static.c:17:
#0 38.03 warning: c_src/mimalloc/include/mimalloc/internal.h: In function '_mi_ptr_segment':
#0 38.03 warning: c_src/mimalloc/include/mimalloc/internal.h:405:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#0 38.03 warning:   405 |   return (mi_segment_t*)(((uintptr_t)p - 1) & ~MI_SEGMENT_MASK);
#0 38.03 warning:       |          ^
#0 38.03 warning: In file included from c_src/mimalloc/src/static.c:34:
#0 38.03 warning: c_src/mimalloc/src/segment.c: In function 'mi_tagged_segment_ptr':
#0 38.03 warning: c_src/mimalloc/src/segment.c:1093:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#0 38.03 warning:  1093 |   return (mi_segment_t*)(ts & ~MI_TAGGED_MASK);
#0 38.03 warning:       |          ^
#0 38.08    Compiling mimalloc v0.1.36 (/build/mimalloc_rust)
#0 38.18    Compiling mimalloc_test v0.1.0 (/build)
#0 38.29 error: linking with `cc` failed: exit status: 1
#0 38.29   |
#0 38.29   = note: LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crti.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustc0SWveE/symbols.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.mimalloc_test.739a7403-cgu.0.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.mimalloc_test.739a7403-cgu.1.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.mimalloc_test.739a7403-cgu.2.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.mimalloc_test.739a7403-cgu.3.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.mimalloc_test.739a7403-cgu.4.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.mimalloc_test.739a7403-cgu.5.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.mimalloc_test.739a7403-cgu.6.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.mimalloc_test.739a7403-cgu.7.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550.2i187zytaey0c0xg.rcgu.o" "-Wl,--as-needed" "-L" "/build/target/arm-unknown-linux-musleabihf/release/deps" "-L" "/build/target/release/deps" "-L" "/build/target/arm-unknown-linux-musleabihf/release/build/libmimalloc-sys-48f2dfc53239e631/out" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-Wl,-Bstatic" "/build/target/arm-unknown-linux-musleabihf/release/deps/libmimalloc-fc3b7fa423938021.rlib" "/build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-58b883546b14cc14.rlib" "/build/target/arm-unknown-linux-musleabihf/release/deps/liblibc-8cbac95de92d3f8a.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd-156f4170e33b8df4.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libpanic_unwind-e270422b4fca28e3.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libobject-49cd4b382f505f9d.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libmemchr-eed355165f4866e0.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libaddr2line-7e4a417a98d3e1fb.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libgimli-19ab14456ef67ec3.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_demangle-94668fbad859bad0.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd_detect-ddbf1f9293a44a9c.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libhashbrown-fac09f5d7f857f6b.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libminiz_oxide-f840348d8fb3422c.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libadler-f7fa56e66eb13c9f.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_alloc-9cb6dfec2a561167.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libunwind-b9f2e553466d47cf.rlib" "-lunwind" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcfg_if-fc80282540c648fb.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liblibc-9f5698308f331dfe.rlib" "-lc" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liballoc-5cb9b7f1b32dd35b.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_core-b2b48d67f7264a3c.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcore-21361f74a01c8c9e.rlib" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcompiler_builtins-eb461ae3a10c4720.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-L" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained" "-o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-15d4fed50dc5c550" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtn.o"
#0 38.29   = note: /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 38.29           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 38.29           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 38.29           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 38.29           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 38.29           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 38.29           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 38.29           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 38.29           /usr/bin/ld: /usr/local/rustup/toolchains/1.68.2-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: error adding symbols: file in wrong format
#0 38.29           collect2: error: ld returned 1 exit status
#0 38.29           
#0 38.29 
#0 38.30 error: could not compile `mimalloc_test` due to previous error

@nicolaspernoud
Copy link

I created an issue on the rust crate, since it is difficult to work out where the problem comes from : purpleprotocol/mimalloc_rust#94 .

@daanx
Copy link
Collaborator

daanx commented Apr 17, 2023

If I look at this post it seems to me that the C or C++ compiler is not consistent -- this is especially tricky with musl-gcc and cross compilation. Maybe the CC and CXX environment is not set correctly when cmake is invoked the first time for mimalloc?
(Note that to fix this you need to remove the cmake build directory first as this is cached so make clean is not enough.)
Also, perhaps it is C versus C++ compilation (mimalloc uses the C compiler by default and you need -DMI_USE_CXX=ON to build as a C++ library).

@octavonce
Copy link
Author

octavonce commented Apr 17, 2023

@daanx Rust uses the C abi and C++ is always invoked through a C layer so cmake is not used. The native gcc compiler is invoked through the build file. The only time a C++ compiler is used is on Windows with msvc.

@daanx
Copy link
Collaborator

daanx commented Apr 24, 2023

Does the latest release fix the build issue?

@octavonce
Copy link
Author

@nicolaspernoud
Copy link

Using mimalloc = "0.1.37", I still have the linking issue :

 > [8/8] RUN cargo build --release --target arm-unknown-linux-musleabihf:
#0 6.479     Updating crates.io index
#0 84.56  Downloading crates ...
#0 85.10   Downloaded libc v0.2.141
#0 85.18   Downloaded mimalloc v0.1.37
#0 85.18   Downloaded libmimalloc-sys v0.1.33
#0 85.40   Downloaded cc v1.0.79
#0 85.58    Compiling libc v0.2.141
#0 85.58    Compiling cc v1.0.79
#0 87.28    Compiling libmimalloc-sys v0.1.33
#0 92.96    Compiling mimalloc v0.1.37
#0 93.12    Compiling mimalloc_test v0.1.0 (/build)
#0 93.31 error: linking with `cc` failed: exit status: 1
#0 93.31   |
#0 93.31   = note: LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crti.o" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustcwBHKjU/symbols.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.mimalloc_test.20080a45-cgu.0.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.mimalloc_test.20080a45-cgu.1.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.mimalloc_test.20080a45-cgu.2.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.mimalloc_test.20080a45-cgu.3.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.mimalloc_test.20080a45-cgu.4.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.mimalloc_test.20080a45-cgu.5.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.mimalloc_test.20080a45-cgu.6.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.mimalloc_test.20080a45-cgu.7.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581.ssojj11ycp7gnke.rcgu.o" "-Wl,--as-needed" "-L" "/build/target/arm-unknown-linux-musleabihf/release/deps" "-L" "/build/target/release/deps" "-L" "/build/target/arm-unknown-linux-musleabihf/release/build/libmimalloc-sys-a0485197edb752df/out" "-L" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-Wl,-Bstatic" "/build/target/arm-unknown-linux-musleabihf/release/deps/libmimalloc-ea0159e9580ea75a.rlib" "/build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-e3ce8485e44d8658.rlib" "/build/target/arm-unknown-linux-musleabihf/release/deps/liblibc-1d35e53f1586ef64.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd-fbbd886251fe1a89.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libpanic_unwind-1bd35c941b382326.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libobject-20ab481ab8e3f957.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libmemchr-6d5fa66af62812db.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libaddr2line-c5d7090aa83583f0.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libgimli-e7814b2b78a60b29.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_demangle-f416c52974a5b58b.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd_detect-36d61d6924dae007.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libhashbrown-75360821ed2ae48e.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libminiz_oxide-01f71d17d25e0689.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libadler-07396f3249a0ab27.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_alloc-1023e934ee76baba.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libunwind-69a54df3a7ca128a.rlib" "-lunwind" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcfg_if-0f0cb69d8bf032e0.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liblibc-eb499cd33737ec75.rlib" "-lc" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liballoc-04652832e0f93b15.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_core-43de1fa801649533.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcore-9688301b6972aad9.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcompiler_builtins-8de29b66878012ac.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-L" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained" "-o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-0dd013925a891581" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtn.o"
#0 93.31   = note: /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 93.31           /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 93.31           /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 93.31           /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 93.31           /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 93.31           /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 93.31           /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 93.31           /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: relocations in generic ELF (EM: 40)
#0 93.31           /usr/bin/ld: /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: error adding symbols: file in wrong format
#0 93.31           collect2: error: ld returned 1 exit status
#0 93.31           
#0 93.31 
#0 93.33 error: could not compile `mimalloc_test` due to previous error

@daanx
Copy link
Collaborator

daanx commented Apr 26, 2023

Ah strange. But given the error I believe this is not a mimalloc issue. If we see this post it seems a cross compilation issue to me in the build files. I see the build command invokes "cc" for example, shouldn't that be "$CC" ? I am guessing one of the .o files has been compiled not for armv6 or musl (but x86_64 or glibc) and that causes trouble later on. Maybe it is found in one of the paths, likes /usr/local before it looks at /usr/sbin or something? Maybe you can use obj dump or nm to see if any of the linked .o/.a files has been build for another platform?

Maybe mimalloc has been build with for the wrong platform, or maybe linked with a wrong .o file? (mimalloc has few dependencies, but perhaps libatomic or pthread?

Try to run the build verbosely so we can see all exact build commands.

@nicolaspernoud
Copy link

I just made a gist with the code : . It is possible to git clone it with git clone https://gist.github.com/a1400af7d11ae4fd52d2de23b49e07bd.git and to run test.sh to get the results.

objdump gives the following result with /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o:
file format elf32-little
architecture: UNKNOWN!, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000

It seems that it is ARM !?

@Gelbpunkt
Copy link

I just made a gist with the code : . It is possible to git clone it with git clone https://gist.github.com/a1400af7d11ae4fd52d2de23b49e07bd.git and to run test.sh to get the results.

objdump gives the following result with /usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o: file format elf32-little architecture: UNKNOWN!, flags 0x00000011: HAS_RELOC, HAS_SYMS start address 0x00000000

It seems that it is ARM !?

The error message makes it pretty clear that it is attempting to link using ld. ld is not able to link for any architecture other than the one it is built for. If you want to actually link ARMv6 objects on x86_64, you will have to use a cross-compiled ld or simply the LLVM lld, which is able to handle all architectures that LLVM supports.

To use a linker capable of handling ARMv6, you can e.g. just tell it to use your gcc by adding .cargo/config.toml:

[target.arm-unknown-linux-musleabihf]
linker = "arm-linux-musleabihf-gcc"

Which will make it compile further and fail with the same atomic errors.

@nicolaspernoud
Copy link

nicolaspernoud commented May 22, 2023

Thanks, my bad, I had actually that set up on my main code but I forgot to include it in the gist.
The gist has been updated, to reproduce the issue :

git clone https://gist.github.com/a1400af7d11ae4fd52d2de23b49e07bd.git
cd a1400af7d11ae4fd52d2de23b49e07bd
chmod +x test.sh
./test.sh

The output is still :

#0 0.535     Updating crates.io index                                                                                                                                                                             
#0 113.1  Downloading crates ...                                                                                                                                                                                  
#0 113.3   Downloaded mimalloc v0.1.37                                                                                                                                                                            
#0 113.4   Downloaded cc v1.0.79                                                                                                                                                                                  
#0 113.4   Downloaded libc v0.2.144
#0 113.5   Downloaded libmimalloc-sys v0.1.33
#0 113.6    Compiling libc v0.2.144
#0 113.6    Compiling cc v1.0.79
#0 113.6      Running `rustc --crate-name build_script_build /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=a50932d461261e8c -C extra-filename=-a50932d461261e8c --out-dir /build/target/release/build/libc-a50932d461261e8c -L dependency=/build/target/release/deps --cap-lints allow`
#0 113.6      Running `rustc --crate-name cc --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.79/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C metadata=af32f740a2f8d743 -C extra-filename=-af32f740a2f8d743 --out-dir /build/target/release/deps -L dependency=/build/target/release/deps --cap-lints allow`
#0 114.0      Running `/build/target/release/build/libc-a50932d461261e8c/build-script-build`
#0 114.0      Running `rustc --crate-name libc /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=9b87afa16299513d -C extra-filename=-9b87afa16299513d --out-dir /build/target/arm-unknown-linux-musleabihf/release/deps --target arm-unknown-linux-musleabihf -C linker=arm-linux-gnueabihf-ld -L dependency=/build/target/arm-unknown-linux-musleabihf/release/deps -L dependency=/build/target/release/deps --cap-lints allow --cfg freebsd11 --cfg libc_priv_mod_use --cfg libc_union --cfg libc_const_size_of --cfg libc_align --cfg libc_int128 --cfg libc_core_cvoid --cfg libc_packedN --cfg libc_cfg_target_vendor --cfg libc_non_exhaustive --cfg libc_long_array --cfg libc_ptr_addr_of --cfg libc_underscore_const_names --cfg libc_const_extern_fn`
#0 114.4    Compiling libmimalloc-sys v0.1.33
#0 114.4      Running `rustc --crate-name build_script_build --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libmimalloc-sys-0.1.33/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="secure"' -C metadata=6a3311d5d7b2bcb0 -C extra-filename=-6a3311d5d7b2bcb0 --out-dir /build/target/release/build/libmimalloc-sys-6a3311d5d7b2bcb0 -L dependency=/build/target/release/deps --extern cc=/build/target/release/deps/libcc-af32f740a2f8d743.rlib --cap-lints allow`
#0 114.8      Running `/build/target/release/build/libmimalloc-sys-6a3311d5d7b2bcb0/build-script-build`
#0 117.2      Running `rustc --crate-name libmimalloc_sys --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libmimalloc-sys-0.1.33/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="secure"' -C metadata=6c742ea2cf46ac27 -C extra-filename=-6c742ea2cf46ac27 --out-dir /build/target/arm-unknown-linux-musleabihf/release/deps --target arm-unknown-linux-musleabihf -C linker=arm-linux-gnueabihf-ld -L dependency=/build/target/arm-unknown-linux-musleabihf/release/deps -L dependency=/build/target/release/deps --extern libc=/build/target/arm-unknown-linux-musleabihf/release/deps/liblibc-9b87afa16299513d.rmeta --cap-lints allow -L native=/build/target/arm-unknown-linux-musleabihf/release/build/libmimalloc-sys-a0485197edb752df/out -l static=mimalloc`
#0 117.2    Compiling mimalloc v0.1.37
#0 117.2      Running `rustc --crate-name mimalloc --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/mimalloc-0.1.37/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="secure"' -C metadata=42574003c2855fe0 -C extra-filename=-42574003c2855fe0 --out-dir /build/target/arm-unknown-linux-musleabihf/release/deps --target arm-unknown-linux-musleabihf -C linker=arm-linux-gnueabihf-ld -L dependency=/build/target/arm-unknown-linux-musleabihf/release/deps -L dependency=/build/target/release/deps --extern libmimalloc_sys=/build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rmeta --cap-lints allow -L native=/build/target/arm-unknown-linux-musleabihf/release/build/libmimalloc-sys-a0485197edb752df/out`
#0 117.3    Compiling mimalloc_test v0.1.0 (/build)
#0 117.3      Running `rustc --crate-name mimalloc_test --edition=2021 main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=2a167cd522443f5b -C extra-filename=-2a167cd522443f5b --out-dir /build/target/arm-unknown-linux-musleabihf/release/deps --target arm-unknown-linux-musleabihf -C linker=arm-linux-gnueabihf-ld -L dependency=/build/target/arm-unknown-linux-musleabihf/release/deps -L dependency=/build/target/release/deps --extern mimalloc=/build/target/arm-unknown-linux-musleabihf/release/deps/libmimalloc-42574003c2855fe0.rlib -L native=/build/target/arm-unknown-linux-musleabihf/release/build/libmimalloc-sys-a0485197edb752df/out`
#0 117.6 error: linking with `arm-linux-gnueabihf-ld` failed: exit status: 1
#0 117.6   |
#0 117.6   = note: LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "arm-linux-gnueabihf-ld" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crt1.o" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crti.o" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtbegin.o" "/tmp/rustclWqGPb/symbols.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.mimalloc_test.bf665f91-cgu.0.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.mimalloc_test.bf665f91-cgu.1.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.mimalloc_test.bf665f91-cgu.2.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.mimalloc_test.bf665f91-cgu.3.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.mimalloc_test.bf665f91-cgu.4.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.mimalloc_test.bf665f91-cgu.5.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.mimalloc_test.bf665f91-cgu.6.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.mimalloc_test.bf665f91-cgu.7.rcgu.o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b.2gyysyuocm9fqnd9.rcgu.o" "--as-needed" "-L" "/build/target/arm-unknown-linux-musleabihf/release/deps" "-L" "/build/target/release/deps" "-L" "/build/target/arm-unknown-linux-musleabihf/release/build/libmimalloc-sys-a0485197edb752df/out" "-L" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-Bstatic" "/build/target/arm-unknown-linux-musleabihf/release/deps/libmimalloc-42574003c2855fe0.rlib" "/build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib" "/build/target/arm-unknown-linux-musleabihf/release/deps/liblibc-9b87afa16299513d.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd-fbbd886251fe1a89.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libpanic_unwind-1bd35c941b382326.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libobject-20ab481ab8e3f957.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libmemchr-6d5fa66af62812db.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libaddr2line-c5d7090aa83583f0.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libgimli-e7814b2b78a60b29.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_demangle-f416c52974a5b58b.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libstd_detect-36d61d6924dae007.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libhashbrown-75360821ed2ae48e.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libminiz_oxide-01f71d17d25e0689.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libadler-07396f3249a0ab27.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_alloc-1023e934ee76baba.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libunwind-69a54df3a7ca128a.rlib" "-lunwind" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcfg_if-0f0cb69d8bf032e0.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liblibc-eb499cd33737ec75.rlib" "-lc" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/liballoc-04652832e0f93b15.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/librustc_std_workspace_core-43de1fa801649533.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcore-9688301b6972aad9.rlib" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/libcompiler_builtins-8de29b66878012ac.rlib" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib" "-L" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained" "-o" "/build/target/arm-unknown-linux-musleabihf/release/deps/mimalloc_test-2a167cd522443f5b" "--gc-sections" "-static" "-z" "relro" "-z" "now" "-O1" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtend.o" "/usr/local/rustup/toolchains/1.69.0-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-musleabihf/lib/self-contained/crtn.o"
#0 117.6   = note: arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o): in function `mi_stat_add.constprop.0':
#0 117.6           static.c:(.text.mi_stat_add.constprop.0+0x3c): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text.mi_stat_add.constprop.0+0x4c): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text.mi_stat_add.constprop.0+0x5c): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text.mi_stat_add.constprop.0+0x6c): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o): in function `mi_stats_add.constprop.0':
#0 117.6           static.c:(.text.mi_stats_add.constprop.0+0xf0): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o):static.c:(.text.mi_stats_add.constprop.0+0x100): more undefined references to `__atomic_fetch_add_8' follow
#0 117.6           arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o): in function `_mi_stat_increase':
#0 117.6           static.c:(.text._mi_stat_increase+0xc0): undefined reference to `__atomic_load_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_increase+0xec): undefined reference to `__atomic_compare_exchange_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_increase+0x108): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o): in function `_mi_stat_decrease':
#0 117.6           static.c:(.text._mi_stat_decrease+0xa8): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_decrease+0xd0): undefined reference to `__atomic_load_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_decrease+0xfc): undefined reference to `__atomic_compare_exchange_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text._mi_stat_decrease+0x118): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o): in function `mi_process_info':
#0 117.6           static.c:(.text.mi_process_info+0x60): undefined reference to `__atomic_load_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text.mi_process_info+0x70): undefined reference to `__atomic_load_8'
#0 117.6           arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o): in function `mi_manage_os_memory_ex2':
#0 117.6           static.c:(.text.mi_manage_os_memory_ex2+0x168): undefined reference to `__atomic_store_8'
#0 117.6           arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o): in function `mi_arenas_try_purge.part.0':
#0 117.6           static.c:(.text.mi_arenas_try_purge.part.0+0x100): undefined reference to `__atomic_load_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text.mi_arenas_try_purge.part.0+0x154): undefined reference to `__atomic_compare_exchange_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text.mi_arenas_try_purge.part.0+0x39c): undefined reference to `__atomic_compare_exchange_8'
#0 117.6           arm-linux-gnueabihf-ld: /build/target/arm-unknown-linux-musleabihf/release/deps/liblibmimalloc_sys-6c742ea2cf46ac27.rlib(static.o): in function `_mi_arena_free':
#0 117.6           static.c:(.text._mi_arena_free+0x238): undefined reference to `__atomic_load_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text._mi_arena_free+0x264): undefined reference to `__atomic_fetch_add_8'
#0 117.6           arm-linux-gnueabihf-ld: static.c:(.text._mi_arena_free+0x2b4): undefined reference to `__atomic_store_8'
#0 117.6           
#0 117.6   = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
#0 117.6   = note: use the `-l` flag to specify native libraries to link
#0 117.6   = 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)
#0 117.6 
#0 117.6 error: could not compile `mimalloc_test` due to previous error
#0 117.6 
#0 117.6 Caused by:
#0 117.6   process didn't exit successfully: `rustc --crate-name mimalloc_test --edition=2021 main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=2a167cd522443f5b -C extra-filename=-2a167cd522443f5b --out-dir /build/target/arm-unknown-linux-musleabihf/release/deps --target arm-unknown-linux-musleabihf -C linker=arm-linux-gnueabihf-ld -L dependency=/build/target/arm-unknown-linux-musleabihf/release/deps -L dependency=/build/target/release/deps --extern mimalloc=/build/target/arm-unknown-linux-musleabihf/release/deps/libmimalloc-42574003c2855fe0.rlib -L native=/build/target/arm-unknown-linux-musleabihf/release/build/libmimalloc-sys-a0485197edb752df/out` (exit status: 1)

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

5 participants