-
Notifications
You must be signed in to change notification settings - Fork 892
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
Got error undefined reference to 'getauxval'
during the compilation on aarch64 with musl
#3324
Comments
undefined reference to
getauxval’` during Rust cross-compile to aarch64 with musl on x86_64undefined reference to 'getauxval'
during Rust cross-compile to aarch64 with musl on x86_64
undefined reference to 'getauxval'
during Rust cross-compile to aarch64 with musl on x86_64undefined reference to 'getauxval'
during the compilation on aarch64 with musl
When I set [profile. release] I also encountered the same problem under musl when linking the main program.
Remove "lto=true" and everything works fine. |
But I don't have that option at all. |
@janvier-vip Could you please provide a docker file or test repo then I can help test it and see what is going on. But I guess this is not a problem from Rustup maybe you should ask about it on Rust/Cargo repo. |
I also encountered this issue, and had a workaround with this:
This file |
same issue, link to build log on CirrusCI.
EDIT: @mitnk |
Could anyone test if this happens for rust from vendor repo. |
I had this when using OpenSSL, moving to Rustls solved it. I don't know if that is also the culprit for other projects. |
Thanks @martadinata666 ! Anyone mention/crosspost this issue to official openssl and openssl rust crate repos? |
Ok, so I've setup a toy-repo with CirrusCI aarch64 runners on Alpine. there are 3 configurations
App does simple dns-over-tls query to example.com alpine latest stable |
I fetched rust from alpine repo and compilation passed. Could you please test with other musl distros to detect where this bug occurs? So what we know for now is:
|
I can confirm point no 1, 4. I dunno about number three, There are some patches from Alpine on their rust package https://git.alpinelinux.org/aports/tree/main/rust?h=master, maybe some key lay there. |
Duplicate?
If it works for everyone, then this thread should be closed, and solution applied upstream sfackler/rust-openssl#2022 |
I confirm that adding below to cargo.toml works for openssl and native-tls options [target.aarch64-unknown-linux-musl]
rustflags = ["-C", "-mno-outline-atomics"] somone else, please confirm. |
@michalszmidt Have you tried put the |
@mitnk musl aarch64 build is waiting in queue. Thanks a lot! |
What work for me is the linker change
|
So if I read the discussion correctly, there's not a rustup issue, just (potential issues) in Rust and/or rust-openssl? |
Well, now I'm confused, as toy repo is fixed with rustflags
I'm a little bit tired with this issue, so I'll workaround this by fetching patched (slightly older) rust from alpine repo. I'm still curious how other musl distros patch rust. |
I can build your actual app hctl with
I saw the run seems you placed the |
Hello, I have the same issue when cross-compiling for an ARM target from a Docker container based on Alpine:3.15:
I have also noticed that
No trace of |
the problem is somehow openssl called this issue "fixed" yet it still happening. So dunno where to start exactly. |
I have no dependency with OpenSSL on my side. IMO it is linked with bindgen tool on Alpine when trying to to use it with 'static' feature enabled. |
I am encountering this with Alpine linux 3.18 in Docker targeting arm64.
A basic build with minimal / no dependencies does not have this error. My issue appears to be related to the
fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
}
[build-dependencies]
built = { version = "0.7.1", features = ["git2"] }
[dependencies]
git2 = { version = "0.18", optional = true, default-features = false, features = [] } |
Here is my linker error, presumably from
|
It seems the origin issue is rust-lang/rust#89626 |
I'm closing this as out of scope: this has nothing to do with the distribution of the Rust toolchain; in fact, this is not even a Rust-related issue as a the build failed when compiling a C library as a Rust project's dependency. Please report the issue to the C library (or the |
Problem
I am trying to build Rust application on aarch64 platform with musl.
After setting up the Docker, I started a container with the latest Alpine image and then installed the Rust and essential components as follows:
Everything looked good. The next step I prepared the main program:
main.rs
Cargo.toml
Then started the building procedure and got the output as follows:
After inspecting the error message, I noticed the problem might on
libcompiler_builtins-50d8ea67cf3a12a5.rlib
, which came withrustup target add
. Actually, they are part of LLVM's compiler-rt.Steps
docker run -ti --name alpine alpine:latest /bin/sh
)hello-reqwest
project, with the content of main.rs and Cargo.toml mentioned above.Possible Solution(s)
No response
Notes
No response
Rustup version
Installed toolchains
The text was updated successfully, but these errors were encountered: