cross
cross copied to clipboard
how can i cross compile rust project from windows10 to linux
Cross.toml:
[build] default-target = "x86_64-unknown-linux-gnu"
[target.x86_64-unknown-linux-gnu] pre-build = [ "apt-get update && apt-get install -y libssl-dev" ]
execute in windows cmd: cross run --target x86_64-unknown-linux-gnu
==================
[33m[1m[cross] warning[0m[39m[1m:[0m using newer rustc 1.80.0 (051478957 2024-07-21)
for the target. Current active rustc on the host is rustc 1.79.0 (129f3b996 2024-06-10)
.
Update with
rustup update
Dockerfile.x86_64-unknown-linux-gnu-custom:5
3 | ARG CROSS_DEB_ARCH= 4 | ARG CROSS_CMD 5 | >>> RUN eval "${CROSS_CMD}"
ERROR: failed to solve: process "/bin/sh -c eval "${CROSS_CMD}"" did not complete successfully: exit code: 100
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/2m9nekppq5j9aevvv3jww4c4k
Error:
0: could not run container
1: when building custom image
2: when pre-building
3: "C:\Program Files\Docker\Docker\resources\bin\docker.exe" build --label 'org.cross-rs.for-cross-target=x86_64-unknown-linux-gnu' --label 'org.cross-rs.workspace_root=d:\works\raymond\bc_works' --tag cross-custom-bc_works:x86_64-unknown-linux-gnu-76b69-pre-build --build-arg 'CROSS_CMD=apt-get update && apt-get install -y libssl-dev' --build-arg 'CROSS_DEB_ARCH=amd64' --file 'd:\works\raymond\bc_works\target\x86_64-unknown-linux-gnu\Dockerfile.x86_64-unknown-linux-gnu-custom' 'd:\works\raymond\bc_works'
failed with exit code: 100
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1: BaseThreadInitThunk
Note: CROSS_CMD=apt-get update && apt-get install -y libssl-dev.
Before that, i've tried use CROSS_CMD in Cross.toml:
[target.x86_64-unknown-linux-gnu] pre-build = [ "dpkg --add-architecture $CROSS_DEB_ARCH", "apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH" ]
but the same problem.