etrombly / rust-crosscompile

docker for cross compiling rust gtk programs to windows
35 stars 6 forks source link

Does not work with Fedora 34 image on DockerHub. #9

Open ajmcmiddlin opened 3 years ago

ajmcmiddlin commented 3 years ago

I tried to build a customised version of the Dockerfile in this repo, but was getting strange permission errors. I was able to work around the first, but it continued to fail when attempting to build a rust project. After specifying fedora:33 as the base image in both cases, everything worked as expected.

At the time I hit the issue, fedora:34 was the latest image on dockerhub. Not sure if this is an issue with the image, or a change in Fedora 34 that means the current Dockerfile will no longer work.

etrombly commented 3 years ago

I just tested with the newest fedora image and it was working here. Can you paste the error here? Make sure if you have a package directory in your project it is deleted. I wasn't cleaning up after the packaging script and that may have been part of the problem.

ajmcmiddlin commented 3 years ago

Sorry, my initial issue wasn't particularly helpful. I was silly and assumed others would hit this issue :).

I just checked out a5aabdc0def3634fbfbbc3e80107ca1f0bd0ec90 and built it with docker build . -t some-tag. I got the following error, which is what I was seeing before. It appears Fedora 34 is still the latest version on docker hub.

Removing intermediate container 38800970945a
 ---> 49bc7a350dda
Step 15/24 : RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
 ---> Running in 61a9bf5dacb5
info: downloading installer
Cannot execute /tmp/tmp.OV6S78W4Uu/rustup-init (likely because of mounting /tmp as noexec).
Please copy the file to a location where you can execute binaries and run ./rustup-init.
The command '/bin/sh -c curl https://sh.rustup.rs -sSf | sh -s -- -y' returned a non-zero code: 1

I can then login to the intermediate image from the step before failure and run things manually. As expected, the shell script fails the same way. However, if I go to the temp directory where the rustup-init binary is downloaded, I can run it manually and install rust without issue.

$ docker run -v ~/my-rust-src:/home/rust/src -it 49bc7a350dda bash -il
[root@d4f7d844df95 /]# curl https://sh.rustup.rs -sSf | sh -s -- -y
info: downloading installer
Cannot execute /tmp/tmp.8NZTivg4kw/rustup-init (likely because of mounting /tmp as noexec).
Please copy the file to a location where you can execute binaries and run ./rustup-init.
[root@d4f7d844df95 /]# cd /tmp/tmp.8NZTivg4kw
[root@d4f7d844df95 tmp.8NZTivg4kw]# ls -l
total 15324
-rwxr--r-- 1 root root 15690192 Jun 11 00:21 rustup-init
[root@d4f7d844df95 tmp.8NZTivg4kw]# ./rustup-init -y
...
Rust is installed now. Great!
...

It appears the rust script is failing when it checks that the rustup-init binary it downloads is executable (line 115 of the script). I can confirm that the shell in the intermediate image doesn't see it as executable.

[root@d4f7d844df95 tmp.8NZTivg4kw]# [ ! -x /tmp/tmp.8NZTivg4kw/rustup-init ] && echo ":("
:(

At this point I have no idea why the rustup-init binary isn't executable according to the shell test. I thought it could be an SELinux thing given it's a Fedora base image, but I have no experience with SELinux and the few things I tried to investigate led me to believe the SELinux isn't operating in this Docker image. I may be totally off there though.

etrombly commented 3 years ago

What is the host OS? I just tried again and not running into the same issue. Also what's your docker version?

ajmcmiddlin commented 3 years ago

Host OS is NixOS 20.09 (a Linux distribution).

$ docker --version
Docker version 19.03.12, build v19.03.12