emk / rust-musl-builder

Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k stars 193 forks source link

Can't compile after moving to edition 2021 #130

Closed kunjee17 closed 2 years ago

kunjee17 commented 3 years ago

What did you try to do? I have updated edition to 2021 and rust to latest version. Part of monthly update.

I have followed the steps provided in migration guild

What happened? Project compiles in local machine. But docker build is breaking with following message error: edition 2021 is unstable and only available with -Z unstable-options.

What did you hope to happen? It should build without any issue.

Does ./test-image work?

If you check out the repository on a Mac or Linux system and run ./build-image, does it succeed or fail? This will build several known-good examples from the rust-musl-builder/examples directory.

Additional information

Is there anything else that we should know? It was working before edition migrated to 2021.

greyblake commented 3 years ago

Until the docker image is updated in the registry, I use the following workaround that works for me:

# Clone the repo
git clone https://github.com/emk/rust-musl-builder.git /tmp/rust-musl-builder

# build your own image
cd /tmp/rust-musl-builder
docker build . -t rust-musl-2021

# cd to you project
# and build it within  rust-musl-2021 container
docker run  --rm -it -v "$(pwd)":/home/rust/src rust-musl-2021 cargo build --release
evanxg852000 commented 2 years ago

@emk Is there anything preventing you from pushing a new tag of this image for the new rust version? It's a shame I have to pull and build on CI when this could be done in one go.

Thanks

martinjaeger commented 2 years ago

@evanxg852000 you can alternatively switch to https://github.com/clux/muslrust, which is what I have done.

kunjee17 commented 2 years ago

I have moved to little bit bigger docker file based on Debian bullseye-slim . It solve other file serving issues from me as well. Yes, size got bigger but it is less headache.

evanxg852000 commented 2 years ago

Thanks, @martinjaeger but that image is not working on my embedded:cross setup.

could not create home directory: '/.rustup': Permission denied (os error 13)

@kunjee17 I don't think it should be closed, though there is a workaround, the issue still stands to update the image with a rebuild.

emk commented 2 years ago

See the discussion here: https://github.com/emk/rust-musl-builder/pull/126. This is the best tracking issue for this problem.

Docker Hub CI builds are no longer free, and this project has no sponsorships. The solution is to migrate our builds to GitHub CI.

emk commented 2 years ago

We now have up-to-date builds using GitHub CI! Thank you to everyone for the encouragement.