Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Docker images for compiling static Rust binaries using musl-cross

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt
NotificationsYou must be signed in to change notification settings

rust-cross/rust-musl-cross

Docker ImageBuildBors enabled

🚀 Help me to become a full-time open-source developer bysponsoring me on GitHub

Docker images for compiling static Rust binaries usingmusl-cross-make,inspired byrust-musl-builder

Prebuilt images

Currently we have the followingprebuilt Docker images on Docker Hub,supports x86_64(amd64) and aarch64(arm64) architectures.

Rust toolchainCross Compile TargetDocker Image Tag
stableaarch64-unknown-linux-muslaarch64-musl
stablearm-unknown-linux-musleabiarm-musleabi
stablearm-unknown-linux-musleabihfarm-musleabihf
stablearmv5te-unknown-linux-musleabiarmv5te-musleabi
stablearmv7-unknown-linux-musleabiarmv7-musleabi
stablearmv7-unknown-linux-musleabihfarmv7-musleabihf
stablei586-unknown-linux-musli586-musl
stablei686-unknown-linux-musli686-musl
stablemips-unknown-linux-muslmips-musl
stablemipsel-unknown-linux-muslmipsel-musl
stablemips64-unknown-linux-muslabi64mips64-muslabi64
stablemips64el-unknown-linux-muslabi64mips64el-muslabi64
stablepowerpc64le-unknown-linux-muslpowerpc64le-musl
stableriscv64gc-unknown-linux-muslriscv64gc-musl
stablex86_64-unknown-linux-muslx86_64-musl

To usearmv7-unknown-linux-musleabihf target for example, first pull the image:

docker pull ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf# Also available on Docker Hub# docker pull messense/rust-musl-cross:armv7-musleabihf

Then you can do:

alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf'rust-musl-builder cargo build --release

This command assumes that$(pwd) is readable and writable. It will output binaries inarmv7-unknown-linux-musleabihf.At the moment, it doesn't attempt to cache libraries between builds, so this is best reserved for making final release builds.

How it works

rust-musl-cross usesmusl-libc,musl-gcc with the help ofmusl-cross-make to make it easy to compile, and the newrustuptarget support.

Use beta/nightly Rust

Currently we install stable Rust by default, if you want to switch to beta/nightly Rust, you can do it by extendingfrom our Docker image, for example to use beta Rust for targetx86_64-unknown-linux-musl:

FROM ghcr.io/rust-cross/rust-musl-cross:x86_64-muslRUN rustup update beta && \    rustup target add --toolchain beta x86_64-unknown-linux-musl

Strip binaries

You can use themusl-strip command inside the image to strip binaries, for example:

docker run --rm -it -v"$(pwd)":/home/rust/src ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf musl-strip /home/rust/src/target/release/example

License

Licensed underThe MIT License

About

Docker images for compiling static Rust binaries using musl-cross

Topics

Resources

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

 
 
 

[8]ページ先頭

©2009-2025 Movatter.jp