Comments (4)
I'm not sure I understand this feature request, I understand the spirit, but not how it would be used.
Could you explain a bit further how this would be done and used?
I'll also explain abit, today it's possible to do
[target.armv7-unknown-linux-musl.image]
name = "ghcr.io/rust-cross/rust-musl-cross"
toolchain = ["linux/arm/v7=armv7-unknown-linux-musl"]
#1104 exists to track how we would generate multiarch images with the cross-compiled binary inside.
side note, I don't think musl-linux
is a valid docker/oci os platform
from cross.
I should clearyfi this more.
I do want use the docker image, used by cross inside the From
step of a Dockerfile for building a rust program.
FROM --platform=$BUILDPLATFORM ghcr.io/rust-cross/rust-musl-cross:aarch64-unknown-linux-musl AS builder
SHELL ["/bin/bash", "-uo", "pipefail", "-c"]
ARG version
RUN apt-get -y update && apt-get -y install protobuf-compiler musl musl-dev musl-tools
ENV PROTOC=/usr/bin/protoc
RUN echo "build version ${version}"
RUN cargo install --locked --git https://github.com/ankitects/anki.git --tag ${version} anki-sync-server
RUN ldd /usr/local/cargo/bin/anki-sync-server
FROM --platform=$BUILDPLATFORM scratch
ENV SYNC_BASE=/data
COPY --from=builder --chmod=0755 /usr/local/cargo/bin/anki-sync-server /
CMD ["./anki-sync-server"]
So I do not use the cross binary, which mean I can not use the meta data section of the cargo.toml.
The problem is that I must change the target in the from step, which make it difficult, to build multi platform image.
Docker does provide the option to use docker Args here. Which are created by buildx.
So you can modifiy the From
step like this:
FROM --platform=$BUILDPLATFORM ghcr.io/rust-cross/rust-musl-cross:$TARGETPLATFORM AS builder
The problem is that TARGETPLATFORM
platform does not match the name of the rust toolchain. Instead it has values like linux/amd64
, linux/arm64
, linux/arm/v7
. Sadly docker does not allow to use a function here, also variables for previous build steps can not be used, so they is currently no way to map this values to the required toolchain.
My suggestion is to add additional linux/amd64
, linux/arm64
, linux/arm/v7
, etc tags, so TARGETPLATFORM
platform can be used directly.
from cross.
aha! I think then that you're on the wrong issue tracker, this is cross-rs
, for the cross
binary that uses it's own docker images and produces binaries on the host system via cross build --target <target>
you probably want to raise this on https://github.com/rust-cross/rust-musl-cross instead! :D
from cross.
Ups sorry for this.
Issue moved to rust-cross/rust-musl-cross#133
from cross.
Related Issues (20)
- FreeBSD docker image has headers and libs in wrong place HOT 1
- Any plan to support higher Ubuntu base image? say, Ubuntu 22.04 LTS? HOT 1
- Cross isn't working due to docker run exiting without error HOT 29
- windows-gnu target can't be emulated arm64 qemu via wine HOT 12
- Compiling udev with hwdb support HOT 3
- Build linux binary from Windows HOT 1
- Config via `package.metadata` does not get read when in a workspace HOT 2
- unable to cross-compile for mips-unknown-linux-musl, anything that uses openssl (e.g. http client, mqtt-client) HOT 4
- Remote docker throws "sh: 1: cargo: not found" error if cargo comes from nix distribution HOT 2
- FreeBSD: Docker image doesn't set PKG_CONFIG_PATH
- cross build --target armv7-unknown-linux-gnueabihf HOT 2
- Investigate bindgen woes - "file not found" HOT 9
- FreeBSD 12 is EoL, update to 13 HOT 1
- `cross metadata` target_dir does not match target dir used during build HOT 5
- cannot install mips-unknown-linux-musl, and 'rustup target --list | grep mips' is empty HOT 1
- Building a custom `initrd` with the `linux-image.sh` script of the docker image fails on powerpc64 HOT 2
- loongarch64 support
- Set `PKG_CONFIG_ALLOW_CROSS=1` inside our dockerfiles instead of on invocation of docker HOT 3
- Unable to `-Zbuild-std` for `mips-unknown-linux-musl` HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cross.