0

I am attempting to build a Docker image using arm32v7/python:3.11.5-slim-bullseye. Due to the fact that this image is 32-bit, there is no pre-built wheel for one of the pip packages I am installing (cryptography), so it must be compiled partially with Rust.

Here is a snippet from my Dockerfile:

# Install Rust with the install script
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Update path to include all Rust-related binaries
ENV PATH="/root/.cargo/bin:${PATH}"

RUN ls /root/.cargo/bin

RUN /root/.cargo/bin/rustup --version
RUN rustup --version

RUN /root/.cargo/bin/rustc --version
RUN rustc --version

When I run the ls command, it correctly displays all of the binaries within the /root/.cargo/bin folder:

#9 [ 5/14] RUN ls /root/.cargo/bin
#9 0.441 cargo
#9 0.441 cargo-clippy
#9 0.441 cargo-fmt
#9 0.441 cargo-miri
#9 0.441 clippy-driver
#9 0.441 rls
#9 0.441 rust-analyzer
#9 0.441 rust-gdb
#9 0.441 rust-gdbgui
#9 0.441 rust-lldb
#9 0.441 rustc
#9 0.441 rustdoc
#9 0.441 rustfmt
#9 0.441 rustup
#9 DONE 1.1s

From this, you can see that all the binaries I am attempting to run are present. When I run the rustup --version commands, both through specifying the direct path and through just the command itself, the command runs, however there seem to be some issues within the output:

#10 [ 6/14] RUN /root/.cargo/bin/rustup --version
#10 0.584 rustup 1.26.0 (5af9b9484 2023-04-05)
#10 0.584 info: This is the version for the rustup toolchain manager, not the rustc compiler.
#10 0.685 info: The currently active `rustc` version is `(error reading rustc version)`
#10 DONE 1.2s

Furthermore, when I attempt to run the rustc binary and through the direct path somehow I get this error:

#12 [ 8/14] RUN /root/.cargo/bin/rustc --version
#12 0.615 error: command failed: 'rustc': No such file or directory (os error 2)
#12 ERROR: process "/bin/sh -c /root/.cargo/bin/rustc --version" did not complete successfully: exit code: 1

What I am struggling to understand is: the binary is clearly present within the filesystem, and even when specifying the direct path to the binary, the command can not be located.

I have tried:

  • Running the rustc binary through rustup run stable rustc -- --version, however I get the same os error 2.
  • Copying the rustc binary to another location and running it. The copy command worked, however I was unable to run the binary even when specifying the direct path.
  • Running the ldd command on /root/.cargo/bin/rustc. All of the shared libraries are present.
  • Attempting to determine whether the binaries are symlinks through the command ls -l /root/.cargo/bin/. The output suggests that none of the binaries are symlinks:
#9 [ 5/15] RUN ls -l /root/.cargo/bin
#9 0.482 total 182840
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 cargo
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 cargo-clippy
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 cargo-fmt
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 cargo-miri
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 clippy-driver
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rls
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rust-analyzer
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rust-gdb
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rust-gdbgui
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rust-lldb
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rustc
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rustdoc
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rustfmt
#9 0.482 -rwxr-xr-x 14 root root 13370420 Sep 23 15:44 rustup
  • Installing a different toolchain version using rustup. This made no difference.

I am expecting the rustc binary to be found and executed, however the system is unable to locate the binary, even when I have specified the absolute path and confirmed its existence.

2
  • Re rustup run: you're using it incorrectly, as the error is pointing out. The argument after run is the toolchain to use, such as stable or nightly. Also make sure that the binaries in ~/.cargo/bin aren't (broken) symlinks. Commented Sep 25, 2023 at 12:10
  • @ColonelThirtyTwo Thank you, I have updated the post with the output of the correct rustup run command. As with whether the binaries are symlinks, I don't believe so. I've updated the post with the output of ls -l in the cargo binaries directory. Commented Sep 25, 2023 at 20:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.