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

cross-rs/x86_64-pc-windows-gnu [image operating system "linux" cannot be used on this platform.] #969

Closed
alexhallam opened this issue Jul 23, 2022 · 8 comments
Labels
needs-information needs more information to replicate regression

Comments

@alexhallam
Copy link

I have been running this test for a few months. This is the first time that I had a merge that failed here. I am not sure if the problem is with cross or something else. Maybe I could just get pointed to the right place to debug the issue.

My github actions issue is here.

https://github.com/alexhallam/tv/runs/7483114840?check_suite_focus=true

Here is a little output of the error.

0.2.4: Pulling from cross-rs/x86_64-pc-windows-gnu
docker: image operating system "linux" cannot be used on this platform.
See 'docker run --help'.
+ rustup component list --toolchain nightly-x86_64-unknown-linux-gnu
Error: Process completed with exit code 1.
@Emilgardis
Copy link
Member

Emilgardis commented Jul 23, 2022

The github actions windows environment does not support running docker images with any other OS than windows. cross will never work by default on windows GHA CI on the provided runners, since we'd have to provide docker images using --platform windows/amd64

Instead, if you want to use cross here, use a linux runner. (or simpler, just use native cargo)

See the last time this workflow ran: https://github.com/alexhallam/tv/runs/6399546363?check_suite_focus=true#step:8:1

Here, cross is sneaky and just fallbacks to cargo. I'll try to figure out why, but it shouldn't have I think.

We seem to have broken this behaviour in 0.2.2/0.2.3/0.2.4.I'm not sure if the breakage is acceptable or not. Imo, the behaviour that's currently exhibited is correct, it should try to run and error if docker doesn't work with linux platforms

@Emilgardis Emilgardis added regression needs-information needs more information to replicate labels Jul 23, 2022
@alexhallam
Copy link
Author

alexhallam commented Jul 24, 2022

Could you point me to the docs that will show my how to use native cargo or run on linux?

I have only interacted with cross via the workflow yaml as seen below.

https://github.com/alexhallam/tv/actions/runs/2311085956/workflow#L94-L97

@Emilgardis
Copy link
Member

absolutely, just replace the windows-2019 reference with ubuntu-18.04 and you should be good.

One thing I notice in that workflow is that you're setting CARGO=cross, try to not do this, instead invoke cross directly.

@jxs
Copy link

jxs commented Aug 16, 2022

Hi,
I tried this:

absolutely, just replace the windows-2019 reference with ubuntu-18.04 and you should be good.

but now getting this issue #238 on the workflow runs

am I missing something?

Thanks!

@Emilgardis
Copy link
Member

the logs contains this:

[cross] warning: `cross` does not provide a Docker image for target i686-pc-windows-msvc, specify a custom image in `Cross.toml`.
[cross] note: Falling back to `cargo` on the host.

we only provide *-pc-windows-gnu, we do have the availability for msvc if you're able to produce the image. See https://github.com/cross-rs/cross-toolchains

@BurntSushi
Copy link

One thing I notice in that workflow is that you're setting CARGO=cross, try to not do this, instead invoke cross directly.

Could you elaborate on this? Why does cross need to be invoked directly? Setting an environment variable is quite useful for running CI actions that work with either cargo natively or cross natively. Is this no longer supported by cross?

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Aug 17, 2022

One thing I notice in that workflow is that you're setting CARGO=cross, try to not do this, instead invoke cross directly.

Could you elaborate on this? Why does cross need to be invoked directly? Setting an environment variable is quite useful for running CI actions that work with either cargo natively or cross natively. Is this no longer supported by cross?

This is fine with the following caveats:

  1. You aren't using cross 0.2.2, where we introduced a bug that caused cross to be called in an infinite loop. This was fixed in 0.2.3.
  2. You call cross via $CARGO, and nothing in the compiled code requires reading the value of CARGO as cross, since it will be set and overridden by cargo itself.

I probably personally would name it CARGO_BIN, just to make it clear the two are separate, but as long as you know these two caveats, setting CARGO=cross is fine.

@BurntSushi
Copy link

Got it, thanks! Using CARGO_BIN sounds smart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-information needs more information to replicate regression
Projects
None yet
Development

No branches or pull requests

5 participants