Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can i cross compile rust project from windows10 to linux #1532

Open
sxfreesky123 opened this issue Aug 1, 2024 · 2 comments
Open

how can i cross compile rust project from windows10 to linux #1532

sxfreesky123 opened this issue Aug 1, 2024 · 2 comments
Labels
A-wsl2-host Area: WSL2 hosts

Comments

@sxfreesky123
Copy link

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
at :
2: RtlUserThreadStart
at :

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.

@Emilgardis
Copy link
Member

ERROR: failed to solve: process "/bin/sh -c eval "${CROSS_CMD}"" did not complete successfully: exit code: 100

Suggests an error with your docker. What does docker-desktop://dashboard/build/desktop-linux/desktop-linux/2m9nekppq5j9aevvv3jww4c4k say? (Paste it into a webbrowser)

@Emilgardis Emilgardis added the A-wsl2-host Area: WSL2 hosts label Aug 1, 2024
@sxfreesky123
Copy link
Author

ERROR: failed to solve: process "/bin/sh -c eval "${CROSS_CMD}"" did not complete successfully: exit code: 100

Suggests an error with your docker. What does docker-desktop://dashboard/build/desktop-linux/desktop-linux/2m9nekppq5j9aevvv3jww4c4k say? (Paste it into a webbrowser)

oh, yes, thank you for reminding me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-wsl2-host Area: WSL2 hosts
Projects
None yet
Development

No branches or pull requests

2 participants