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

Instructions unclear for msvc build #38

Open
alshdavid opened this issue Aug 17, 2023 · 1 comment
Open

Instructions unclear for msvc build #38

alshdavid opened this issue Aug 17, 2023 · 1 comment

Comments

@alshdavid
Copy link

alshdavid commented Aug 17, 2023

Hi all, I'm trying to cross compile for Windows amd64 and arm64 while on a Windows host.

I'm attempting to follow the instructions for the msvc build but am failing - probably on something simple.

I'm using a Github Actions host using windows-latest. My build script looks like:

curl https://sh.rustup.rs -sSf | sh -s -- -y
cargo install cross

git clone https://github.com/cross-rs/cross /cross
cd /cross
git submodule update --init --remote

# I have tried with and without the following line
cargo xtask configure-crosstool x86_64-pc-windows-msvc

cargo build-docker-image x86_64-pc-windows-msvc --tag local

# Never gets this far
echo '\n' >> Cargo.toml
echo '[target.x86_64-pc-windows-msvc]\n' >> Cargo.toml
echo 'image = "ghcr.io/cross-rs/x86_64-pc-windows-msvc:local"\n' >> Cargo.toml

cross run --release --target x86_64-pc-windows-msvc

You can see the logs here: https://github.com/alshdavid-labs/cross-platform-binary-template/actions/runs/5892634303/job/15982367248

This results in the following error:

Run git clone https://github.com/cross-rs/cross /cross
Cloning into '/cross'...
Submodule 'docker/cross-toolchains' (https://github.com/cross-rs/cross-toolchains.git) registered for path 'docker/cross-toolchains'
Cloning into 'D:/cross/docker/cross-toolchains'...
Submodule path 'docker/cross-toolchains': checked out '4299096a1468f91aa9a[7](https://github.com/alshdavid-labs/cross-platform-binary-template/actions/runs/5892357823/job/15981437973#step:4:8)430e4763de6[8](https://github.com/alshdavid-labs/cross-platform-binary-template/actions/runs/5892357823/job/15981437973#step:4:9)5cb386a1'
    Updating crates.io index
 Downloading crates ...
  Downloaded same-file v1.0.6
  Downloaded thiserror-impl v1.0.40
   ....
   ....
   ....
   Compiling wildmatch v2.1.1
   Compiling xtask v0.0.0-dev.0 (D:\cross\xtask)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 56s
     Running `target\debug\xtask.exe configure-crosstool x86_64-pc-windows-msvc`
Error: 
   0: unable to find config for target "x86_64-pc-windows-msvc"

Location:
   xtask\src\crosstool.rs:73

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: process didn't exit successfully: `target\debug\xtask.exe configure-crosstool x86_64-pc-windows-msvc` (exit code: 1)
    Finished dev [unoptimized + debuginfo] target(s) in 0.21s
     Running `target\debug\xtask.exe build-docker-image x86_64-pc-windows-msvc --tag local`
Error: 
   0: unable to find dockerfile for target "x86_64-pc-windows-msvc"

Location:
   xtask\src\build_docker_image.rs:105

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: process didn't exit successfully: `target\debug\xtask.exe build-docker-image x86_64-pc-windows-msvc --tag local` (exit code: 1)
Error: Process completed with exit code 1.
@AregevDev
Copy link

AregevDev commented Jul 6, 2024

Bump
Seems like your image files are incorrect. Make sure you build the x86_64-pc-windows-msvc-cross docker image (and not x86_64-pc-windows-msvc. Your cross configuration should be in Cross.toml, not Cargo.toml.

#inside the cross directory with git submodules updated
cargo xtask configure-crosstool #configure
cargo build-docker-image x86_64-pc-windows-msvc-cross --tag local #notice the cross suffix
rustup target add x86_64-pc-windows-msvc

Then add the following to the Cross.toml file in your crate root directory

[target.x86_64-pc-windows-msvc]
image = "ghcr.io/cross-rs/x86_64-pc-windows-msvc-cross:local"

Finally, run cross build --target x86_64-pc-windows-msvc
Works for me under Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants