rustup: `rustup-init.sh` fails to detect platform correctly under `docker buildx` which lacks `/proc`
rustup-init.sh installs the incorrect rustc and other binaries because of a failure to detect arch.
Problems: /proc/self/exe does not exist during docker build, so i686/386 etc is detected incorrectly as x86_64 due to failure on line 153. mips64 likely suffers the same issue because it also uses get_bitness
grep '^Features' /proc/cpuinfo | grep -q -v neon fails and ARMv6 is incorrectly detected as arm7 on line 367
Running the downloaded binary fails with /lib/ld-linux-armhf.so.3: No such file or directory (because it isnt armhf, it is armel at /lib/ld-linux.so.3 )
Logs and example code to produce the container and error: https://gist.github.com/miigotu/2a0b80677420d806c96d8e792ae6652e
Note: gcc inside the container reports the correct info, kernel reports x86_64
root@386c88edfbc5:/# uname -m
x86_64
root@386c88edfbc5:/# gcc -dumpmachine | sed "s/-/-$(uname -p)-/"
i686-unknown-linux-gnu
and
root@dac44b74e4c0:/# uname -m
armv7l
root@dac44b74e4c0:/# gcc -dumpmachine | sed "s/-/-$(uname -p)-/"
arm-unknown-linux-gnueabi
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 18 (5 by maintainers)
Commits related to this issue
- ci: try working around rust-lang/rustup#2700 — committed to ctron/trunk-container by ctron a year ago
This is my temporary solution that works (building python cryptography):
I am getting this on macOS Monterey:
I am inside of a container built on:
FROM --platform=linux/amd64 mcr.microsoft.com/vscode/devcontainers/cpp:0-debian-11. I am running linux/amd64 under Docker’s built-in QEMU emulation. The container build process is fairly involved, so it definitely functions in general. I also can run other x86_64 applications in general in the container.Cargo does install correctly though, so it doesn’t hurt anything. Originally I thought this was a problem, but it still installs as expected. I figured this was still worth reporting here as another example of this occurring.
@miigotu I actually managed to get it running! I tried your command from the previous comment, but it seems that the SHELL env var was undeclared, so I just replaced it with “/bin/sh” and voilà!
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sed 's#/proc/self/exe#\/bin\/sh#g' | sh -s -- -yFor transparency: I was running the build through compose, with the following adjustments:
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose buildFROM --platform=linux/amd64 ubuntu:20.04at the beginningplatform: linux/amd64on the container (probably superfluous)In my case it turned out that a
podman system reset(deletes all containers, images, etc.) did the trick; possibly the container was bugged and a new version fixed the problem.aarch64-apple-darwin