-
Notifications
You must be signed in to change notification settings - Fork 382
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
aarch64 builds using nightly fail with missing getauxval
in init_have_lse_atomics
in cpu_model.c
in compiler_builtins
#598
Comments
(For reference, |
OK, after rather a lot of flailing about, I've managed to get Here's a (whitespace-adjusted reformatted-to-multiline-with-backslashes) version of the command that PATH=$PATH:/rust/bin \
CARGO=/rust/bin/cargo \
CARGO_BIN_NAME=foo \
CARGO_CRATE_NAME=foo \
CARGO_MANIFEST_DIR=/project \
CARGO_PKG_AUTHORS='' \
CARGO_PKG_DESCRIPTION='' \
CARGO_PKG_HOMEPAGE='' \
CARGO_PKG_LICENSE='' \
CARGO_PKG_LICENSE_FILE='' \
CARGO_PKG_NAME=foo \
CARGO_PKG_REPOSITORY='' \
CARGO_PKG_VERSION=0.1.0 \
CARGO_PKG_VERSION_MAJOR=0 \
CARGO_PKG_VERSION_MINOR=1 \
CARGO_PKG_VERSION_PATCH=0 \
CARGO_PKG_VERSION_PRE='' \
CARGO_PRIMARY_PACKAGE=1 \
LD_LIBRARY_PATH='/target/debug/deps:/rust/lib' \
rustc \
--crate-name foo \
--edition=2018 \
src/main.rs \
--error-format=json \
--json=diagnostic-rendered-ansi \
--crate-type bin \
--emit=dep-info,link \
-C embed-bitcode=no \
-C debuginfo=2 \
-C metadata=cba3bae5335ad02d \
-C extra-filename=-cba3bae5335ad02d \
--out-dir /target/aarch64-unknown-linux-musl/debug/deps \
--target aarch64-unknown-linux-musl \
-C linker=aarch64-linux-musl-gcc \
-C incremental=/target/aarch64-unknown-linux-musl/debug/incremental \
-L dependency=/target/aarch64-unknown-linux-musl/debug/deps \
-L dependency=/target/debug/deps \
-C link-arg=-lgcc To this I added the following, at the end: ... \
-C link-arg=/usr/local/aarch64-linux-musl/lib/libc.a So, the whole docker invocation that successfully built me an executable nightly "/usr/bin/docker" "run" \
"--userns" "host" \
"-e" "LDFLAGS" \
"-e" "PKG_CONFIG_ALLOW_CROSS=1" \
"--rm" \
"--user" "1000:1000" \
"-e" "XARGO_HOME=/xargo" \
"-e" "CARGO_HOME=/cargo" \
"-e" "CARGO_TARGET_DIR=/target" \
"-e" "USER=tonyg" \
"-e" "CROSS_RUNNER=" \
"-v" "/home/tonyg/.xargo:/xargo:Z" \
"-v" "/home/tonyg/.cargo:/cargo:Z" \
"-v" "/cargo/bin" \
"-v" "/home/tonyg/nobackup/build/issue-598/foo:/project:Z" \
"-v" "/home/tonyg/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu:/rust:Z,ro" \
"-v" "/home/tonyg/nobackup/build/issue-598/foo/target:/target:Z" \
"-w" "/project" \
"-i" "rustembedded/cross:aarch64-unknown-linux-musl-0.2.1" \
"sh" \
"-c" \
"PATH=$PATH:/rust/bin CARGO=/rust/bin/cargo CARGO_BIN_NAME=foo CARGO_CRATE_NAME=foo CARGO_MANIFEST_DIR=/project CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=foo CARGO_PKG_REPOSITORY='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/target/debug/deps:/rust/lib' rustc --crate-name foo --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=cba3bae5335ad02d -C extra-filename=-cba3bae5335ad02d --out-dir /target/aarch64-unknown-linux-musl/debug/deps --target aarch64-unknown-linux-musl -C linker=aarch64-linux-musl-gcc -C incremental=/target/aarch64-unknown-linux-musl/debug/incremental -L dependency=/target/aarch64-unknown-linux-musl/debug/deps -L dependency=/target/debug/deps -C link-arg=-lgcc -C link-arg=/usr/local/aarch64-linux-musl/lib/libc.a" (The last long line there is just a one-line version of the So, looking forward:
|
(Also: for debugging this I have found commands like |
Automated WorkaroundIn [build.env]
passthrough = [
"RUSTFLAGS",
"CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS",
] and then CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C link-arg=/usr/local/aarch64-linux-musl/lib/libc.a" \
cross -vv build -vv --target=aarch64-unknown-linux-musl Interesting points to note:
An alternative workaroundCourtesy of @hkratz here, is to use CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Zgcc-ld=lld" \
cross build --target=aarch64-unknown-linux-musl Relevant links
|
So one possible general (?) fix might be to modify |
Related to rust-lang/libc#2450, this is probably an issue in libc and not cross |
Does this issue disappear if you pin libc to say 0.2.102 ? |
No. If I add a dependency |
You are correct, I missed that the project didn't use libc, just assumed so. My bad! The issue is now tracked in rust-lang/rust#89626 , closing this issue. |
Signed-off-by: Szabolcs Hubai <[email protected]>
[Updated] Workaround
See this comment.
To reproduce
mkdir foo
cd foo
cargo init
cross build --target=aarch64-unknown-linux-musl --release --all-targets
-- note that this succeedsecho 'nightly' > rust-toolchain
cross build --target=aarch64-unknown-linux-musl --release --all-targets
-- note that this failsActual outcome
Step 6 fails with
Expected outcome
Step 6 should succeed :-)
The text was updated successfully, but these errors were encountered: