Multi-platform docker images for cross-compiling Rust projects that use
OpenSSL.
First install cross
cargo install cross --git https://github.com/cross-rs/cross
Then add one or more of the provided images to your Cross.toml file
[target.aarch64-unknown-linux-musl]
image = "ghcr.io/rossmacarthur/cross-openssl:aarch64-unknown-linux-musl"Now you can test or build your project with cross and the OpenSSL libraries
will be available for linking
cross test --target aarch64-unknown-linux-musl
cross build --target aarch64-unknown-linux-musl --releaseWhen cross-compiling on ARM64 hosts you will need to tell cross to use the
correct the toolchain. Here is a config that works on both AMD64 and ARM64
hosts.
[target.aarch64-unknown-linux-musl]
image.name = "ghcr.io/rossmacarthur/cross-openssl:aarch64-unknown-linux-musl"
image.toolchain = ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]See the GitHub Container Registry for the full list of available images
Each image is based on Ubuntu 24.04 and is tagged by its Rust target triple. The following Rust targets are currently supported:
aarch64-unknown-linux-gnuaarch64-unknown-linux-muslarmv7-unknown-linux-gnueabihfarmv7-unknown-linux-musleabihfx86_64-unknown-linux-gnux86_64-unknown-linux-musl
GNU images install OpenSSL into the target library directory under /usr. MUSL
images build OpenSSL with no-shared no-async, install it under /openssl, and
set OPENSSL_DIR, OPENSSL_INCLUDE_DIR, and OPENSSL_LIB_DIR.
Release images are published as multi-platform manifests for linux/amd64 and
linux/arm64. Docker selects the matching image for the host platform by
default. For each release tag, the workflow publishes these tag families:
| Tag pattern | OpenSSL version |
|---|---|
<target> |
3 (for now) |
<target>-<release> |
3 (for now) |
<target>-openssl3.0 |
3.0 track |
<target>-openssl3.0-<release> |
3.0 track |
<target>-openssl3.0.16 |
3.0.16 |
<target>-openssl3.0.16-<release> |
3.0.16 |
<target>-openssl1.1 |
1.1 track |
<target>-openssl1.1-<release> |
1.1 track |
<target>-openssl1.1.1w |
1.1.1w |
<target>-openssl1.1.1w-<release> |
1.1.1w |
Where <target> is the Rust target triple, and <release> is the release tag
of this repository. Every tag pattern in the table is a multi-platform manifest.
To pull a single Docker image platform directly, append -amd64 or -arm64 to
any tag pattern, for example <target>-amd64, <target>-<release>-arm64,
<target>-openssl3.0-arm64, or <target>-openssl1.1.1w-<release>-amd64. These
suffixes refer to the Docker image platform, not the Rust target architecture.
The platform-specific tags are the source images used to create the
multi-platform manifests above.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.