rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.82k stars 12.5k forks source link

building on arm64 hardware under armv7 qemu emulation want to use wrong platform #75073

Open iav opened 4 years ago

iav commented 4 years ago

I use arm64 hardware to make armv7 and aarch64 platform docker containers with rust project inside. To get armv7 on aarch64 platform used qemu emulation via docker buildx. rust 1.44 works as should. Started from 1.45 it brokes:

FROM rust:1.45 as rust
RUN USER=root cargo new app
WORKDIR /app
RUN mkdir -p ./src/bin && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
RUN rustc --version --verbose
RUN cargo build --release --verbose

start on aarch64: docker buildx build --platform linux/arm/v7 --progress plain . output:

#6 [3/4] RUN rustc --version --verbose
#6 0.293 info: syncing channel updates for '1.45.1-aarch64-unknown-linux-gnu'
#6 0.960 info: latest update on 2020-07-30, rust version 1.45.1 (c367798cf 2020-07-26)
#6 0.960 info: downloading component 'cargo'
#6 1.456 info: downloading component 'rust-std'
#6 2.915 info: downloading component 'rustc'
#6 8.791 info: installing component 'cargo'
#6 8.794 info: Defaulting to 500.0 MiB unpack ram
#6 9.854 info: installing component 'rust-std'
#6 12.12 info: installing component 'rustc'
#6 22.04 error: command failed: 'rustc'
#6 22.04 error: caused by: No such file or directory (os error 2)
#6 ERROR: executor failed running [/bin/sh -c rustc --version --verbose]: buildkit-runc did not terminate successfully

How it looks like for rust:1.44

#8 [5/6] RUN rustc --version --verbose
#8 0.230 rustc 1.44.1 (c7087fe00 2020-06-17)
#8 0.230 binary: rustc
#8 0.230 commit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7
#8 0.230 commit-date: 2020-06-17
#8 0.230 host: armv7-unknown-linux-gnueabihf
#8 0.230 release: 1.44.1
#8 0.230 LLVM version: 9.0
#8 DONE 0.3s

#9 [6/6] RUN cargo build --release --verbose
#9 0.330    Compiling app v0.1.0 (/app)
#9 0.330      Running `rustc --crate-name app --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=e0e87e943b5623ed -C extra-filename=-e0e87e943b5623ed --out-dir /app/target/release/deps -L dependency=/app/target/release/deps`
#9 0.331      Running `rustc --crate-name main --edition=2018 src/bin/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=198a25098b0a5694 -C extra-filename=-198a25098b0a5694 --out-dir /app/target/release/deps -L dependency=/app/target/release/deps`
#9 1.785     Finished release [optimized] target(s) in 1.60s
#9 DONE 2.0s

Seems rust 1.45 wrongs when tries to get a platform. 1.44 takes it correct.

JohnTitor commented 4 years ago

This is related to ARM platforms. @rustbot ping arm

rustbot commented 4 years ago

Hey ARM Group! This bug has been identified as a good "ARM candidate". In case it's useful, here are some instructions for tackling these sorts of bugs. Maybe take a look? Thanks! <3

cc @JamieCunliffe @joaopaulocarreiro @raw-bin @Stammark @vigoux

spastorino commented 4 years ago

Assigning P-medium as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.