cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.27k stars 357 forks source link

set QEMU_LD_PREFIX in the runners in order to be able to use env -i #1420

Closed glehmann closed 5 months ago

glehmann commented 5 months ago

I'm working on making assert_cmd working with cross.

There is one case a bit more difficult: when using clear_env() on a process, or env -i, the binary is not able to run anymore because the QEMU_LD_PREFIX envvar is not set anymore.

A (relatively) easy fix might be to ensure in linux-runner — and in any other runner — that the necessary environment is configured before running the executable. Something as proposed in this PR for aarch64-unknown-linux-gnu.

Would that be an acceptable solution?

https://github.com/assert-rs/assert_cmd/pull/193

glehmann commented 5 months ago

Nice workaround! I'm fine with this approach, I would however like to see it done in all images and not just aarch64!

Sure! I was just checking that you were ok with that before patching all the images — there is quite a lot :)

I'm thinking to start by adding a test that runs env -i ${CROSS_TARGET_RUNNER} /a/command. That way we should be sure that we have the minimum environment configured in each image.

I also have a slight concern about what happens if the env is wiped and @DEFAULT_QEMU_LD_PREFIX@ hasn't been replaced by us.

@DEFAULT_QEMU_LD_PREFIX@ is just the default value in ${QEMU_LD_PREFIX:-@DEFAULT_QEMU_LD_PREFIX@}, and QEMU_LD_PREFIX is still set in the docker image. So if @DEFAULT_QEMU_LD_PREFIX@ is not replaced by its value, cross will continue to work as it does today: just fine in most case, and not able to run the executable if the env is cleaned.

We should, if this lands, ensure that https://github.com/cross-rs/cross-toolchains also has been updated

ok, just a few more images ;-)

Emilgardis commented 5 months ago

@DEFAULT_QEMU_LD_PREFIX@ is just the default value in ${QEMU_LD_PREFIX:-@DEFAULT_QEMU_LD_PREFIX@}, and QEMU_LD_PREFIX is still set in the docker image. So if @DEFAULT_QEMU_LD_PREFIX@ is not replaced by its value, cross will continue to work as it does today: just fine in most case, and not able to run the executable if the env is cleaned.

I understand this, my concern is simply about what qemu does when the env has been cleared, the default has not been replaced by the docker build and the only path in QEMU_LD_PREFIX is a relative-looking non-existant path (@DEFAULT_QEMU_LD_PREFIX@). I don't think anything bad will happen but just wanted to raise it :D.

rg -l 'CROSS_TARGET_RUNNER=' -g 'Dockerfile.*linux*' should be all the files that need to be fixed (haven't tested this, no access to my computer rn)

glehmann commented 5 months ago

I understand this, my concern is simply about what qemu does when the env has been cleared, the default has not been replaced by the docker build and the only path in QEMU_LD_PREFIX is a relative-looking non-existant path (@DEFAULT_QEMU_LD_PREFIX@). I don't think anything bad will happen but just wanted to raise it :D.

so I've tested it:

Emilgardis commented 5 months ago

/ci try -t linux

github-actions[bot] commented 5 months ago

Starting try run. Link to action

github-actions[bot] commented 5 months ago

Try run for comment

Failed Jobs

Successful Jobs

List - [aarch64-linux-android](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895353264?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-gnu:centos](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895353440?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895353620?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895353823?pr=1420#step:10:1) - ✔️ - [arm-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895354032?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895354228?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895354414?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895354609?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-musleabihf](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895354788?pr=1420#step:10:1) - ✔️ - [armv5te-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895354974?pr=1420#step:10:1) - ✔️ - [armv5te-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895355176?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895355365?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895355562?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-musleabihf](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895355759?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895356012?pr=1420#step:10:1) - ✔️ - [i586-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895356221?pr=1420#step:10:1) - ✔️ - [armv7-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895356457?pr=1420#step:10:1) - ✔️ - [i586-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895356662?pr=1420#step:10:1) - ✔️ - [i686-linux-android](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895356862?pr=1420#step:10:1) - ✔️ - [i686-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895357055?pr=1420#step:10:1) - ✔️ - [i686-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895357288?pr=1420#step:10:1) - ✔️ - [mips64el-unknown-linux-gnuabi64](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895357521?pr=1420#step:10:1) - ✔️ - [mips64-unknown-linux-gnuabi64](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895357940?pr=1420#step:10:1) - ✔️ - [mipsel-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895358448?pr=1420#step:10:1) - ✔️ - [mips-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895358639?pr=1420#step:10:1) - ✔️ - [powerpc64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895359022?pr=1420#step:10:1) - ✔️ - [powerpc64le-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895359247?pr=1420#step:10:1) - ✔️ - [powerpc-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895359611?pr=1420#step:10:1) - ✔️ - [s390x-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895360050?pr=1420#step:10:1) - ✔️ - [sparc64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895360289?pr=1420#step:10:1) - ✔️ - [thumbv7neon-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895360524?pr=1420#step:10:1) - ✔️ - [thumbv7neon-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895360742?pr=1420#step:10:1) - ✔️ - [x86_64-linux-android](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895360984?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-linux-gnu:centos](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895361185?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895361372?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7666771050/job/20895361561?pr=1420#step:10:1) - ✔️
Emilgardis commented 5 months ago

The errors are expected I think

Emilgardis commented 5 months ago

I just realised something I shouldve thought about 😊 the tests dont ever hit this :D

Emilgardis commented 5 months ago

I think we should a new testcase that either uses assert_cmd or simulates the env clearing.

Emilgardis commented 5 months ago

/ci try -t aarch64-unknown-linux- -t i686-linux*

github-actions[bot] commented 5 months ago

Starting try run. Link to action

github-actions[bot] commented 5 months ago

Try run for comment

Failed Jobs

Successful Jobs

glehmann commented 5 months ago

I think the tests won't help until the PR made it to the main branch: they are not using the image from this PR.

https://github.com/cross-rs/cross/actions/runs/7679215720/job/20929912781?pr=1420##step:11:29

interesting to see that some tests are passing though — QEMU_LD_PREFIX doesn't seem to be necessary for all the targets

Emilgardis commented 5 months ago

They are definitely using the new images, see --tag ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main and sed ...

glehmann commented 5 months ago

oh, ok my bad: I've been confused by the name ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main. I've downloaded it locally and it doesn't contain the changes of the PR.

I'm looking at it

glehmann commented 5 months ago

I tried to rebuild the image from scratch and rerun the test locally — it still runs without problem.

I've set CROSS_DEBUG in test.sh to get a better chance to understand what is going on in the CI

glehmann commented 5 months ago

/ci try -t aarch64-unknown-linux-* -t i686-linux

glehmann commented 5 months ago

my attempt at triggering a new test run deesn't seem very effective

@Emilgardis could you trigger a new run for this PR?

Emilgardis commented 5 months ago

/ci try -t aarch64-unknown-linux- -t i686-linux*

github-actions[bot] commented 5 months ago

Starting try run. Link to action

Emilgardis commented 5 months ago

If you can't figure it out I'll take a closer look into it myself! Seems very strange that it passes for you locally :/

Sidenote: I've been wanting to make the tests a bit more reliable to run and be more structured, meaning migrating the bash script to rust. I have a local branch doing just that but need to finish it

github-actions[bot] commented 5 months ago

Try run for comment

Failed Jobs

Successful Jobs

glehmann commented 5 months ago

on the CI:

it fails on the line 3 of launch.rs: it can't retreive the CARGO_TARGET_AARCH64_UNKNOWN_LINUX_RUNNER env var.

I don't know what is qemu-system is it possible that it clears the environment variables?

glehmann commented 5 months ago

BTW I am launching the test locally with TARGET=aarch64-unknown-linux-gnu CROSS_TARGET_AARCH64_UNKNOWN_LINUX_GNU_IMAGE=cross-aarch64-unknown-linux-gnu ./ci/test.sh, without any RUNNERS env var, so I am never running with qemu-system.

Emilgardis commented 5 months ago

ofc! That's a tricky problem, I'd say lets just skip this test if the runner is qemu-system

glehmann commented 5 months ago

ofc! That's a tricky problem, I'd say lets just skip this test if the runner is qemu-system

done! Could you trigger the CI again?

Emilgardis commented 5 months ago

/ci try -t aarch64-unknown-linux- -t i686-linux*

github-actions[bot] commented 5 months ago

Starting try run. Link to action

github-actions[bot] commented 5 months ago

Try run for comment

Failed Jobs

Successful Jobs

glehmann commented 5 months ago

@Emilgardis could you run the CI again? There was a remaining runner config in Cross.toml from the previous test that was forcing the test to running with qemu-system

Emilgardis commented 5 months ago

/ci try -t aarch64-unknown-linux- -t i686-linux*

github-actions[bot] commented 5 months ago

Starting try run. Link to action

github-actions[bot] commented 5 months ago

Try run for comment

Successful Jobs

Emilgardis commented 5 months ago

going to do one last try with all targets to see if we missed anything obvious, I expect this try to fail for mips and riscv due to other problems not related to this changeset.

Emilgardis commented 5 months ago

/ci try

github-actions[bot] commented 5 months ago

Starting try run. Link to action

glehmann commented 5 months ago

apparently we'll need a few more environment variables: https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963153896#step:12:3102

the CARGO_TARGET_*_RUNNER can't be found on windows: https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963144833#step:12:847 . Same for wasm: https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963151310#step:12:839 .

I'm not sure how much sense it makes to run this kind of test in wasm: are we even allowed to start a new process?

For windows I think I have to write the test to not depend on CARGO_TARGET_*_RUNNER env var, because the launch binary can probably launch another program without a runner. We probably have to add a .exe in the command path…

zig test is failing, but it doesn't seem related to the changes here was it failing before?

github-actions[bot] commented 5 months ago

Try run for comment

Failed Jobs

List - [i686-pc-windows-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963144833?pr=1420#) - ❌ - [mips64el-unknown-linux-muslabi64](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963146131?pr=1420#) - ❌ - [mips64-unknown-linux-muslabi64](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963146573?pr=1420#) - ❌ - [mipsel-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963147015?pr=1420#) - ❌ - [mips-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963147443?pr=1420#) - ❌ - [riscv64gc-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963148072?pr=1420#) - ❌ - [sparcv9-sun-solaris](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963149053?pr=1420#) - ❌ - [wasm32-unknown-emscripten](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963151310?pr=1420#) - ❌ - [x86_64-pc-windows-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963152142?pr=1420#) - ❌ - [x86_64-sun-solaris](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963152605?pr=1420#) - ❌ - [x86_64-unknown-linux-gnu:centos](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963153674?pr=1420#) - ❌ - [x86_64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963153896?pr=1420#) - ❌ - [zig](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963154311?pr=1420#) - ❌

Successful Jobs

List - [aarch64-linux-android](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963139660?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-freebsd](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963139872?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-gnu:centos](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963140075?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963140491?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963140778?pr=1420#step:10:1) - ✔️ - [arm-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963141007?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963141245?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963141694?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963141917?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-musleabihf](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963142138?pr=1420#step:10:1) - ✔️ - [armv5te-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963142364?pr=1420#step:10:1) - ✔️ - [armv5te-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963142579?pr=1420#step:10:1) - ✔️ - [armv7-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963142789?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963142992?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963143206?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-musleabihf](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963143439?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963143670?pr=1420#step:10:1) - ✔️ - [cross](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963143895?pr=1420#step:10:1) - ✔️ - [i586-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963144138?pr=1420#step:10:1) - ✔️ - [i586-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963144345?pr=1420#step:10:1) - ✔️ - [i686-linux-android](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963144618?pr=1420#step:10:1) - ✔️ - [i686-unknown-freebsd](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963145082?pr=1420#step:10:1) - ✔️ - [i686-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963145328?pr=1420#step:10:1) - ✔️ - [i686-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963145540?pr=1420#step:10:1) - ✔️ - [mips64el-unknown-linux-gnuabi64](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963145776?pr=1420#step:10:1) - ✔️ - [mips64-unknown-linux-gnuabi64](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963146340?pr=1420#step:10:1) - ✔️ - [mipsel-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963146843?pr=1420#step:10:1) - ✔️ - [mips-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963147240?pr=1420#step:10:1) - ✔️ - [powerpc64le-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963147667?pr=1420#step:10:1) - ✔️ - [powerpc64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963147856?pr=1420#step:10:1) - ✔️ - [powerpc-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963148261?pr=1420#step:10:1) - ✔️ - [s390x-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963148489?pr=1420#step:10:1) - ✔️ - [sparc64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963148816?pr=1420#step:10:1) - ✔️ - [thumbv6m-none-eabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963149340?pr=1420#step:10:1) - ✔️ - [thumbv7em-none-eabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963149639?pr=1420#step:10:1) - ✔️ - [thumbv7em-none-eabihf](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963149840?pr=1420#step:10:1) - ✔️ - [thumbv7m-none-eabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963150085?pr=1420#step:10:1) - ✔️ - [thumbv7neon-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963150284?pr=1420#step:10:1) - ✔️ - [thumbv7neon-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963150457?pr=1420#step:10:1) - ✔️ - [thumbv8m.base-none-eabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963150651?pr=1420#step:10:1) - ✔️ - [thumbv8m.main-none-eabi](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963150840?pr=1420#step:10:1) - ✔️ - [thumbv8m.main-none-eabihf](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963151029?pr=1420#step:10:1) - ✔️ - [x86_64-apple-darwin](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963151673?pr=1420#step:10:1) - ✔️ - [x86_64-linux-android](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963151905?pr=1420#step:10:1) - ✔️ - [x86_64-pc-windows-msvc](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963152375?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-dragonfly](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963152837?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-freebsd](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963153076?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-illumos](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963153440?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963154105?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-netbsd](https://github.com/cross-rs/cross/actions/runs/7693713886/job/20963154639?pr=1420#step:10:1) - ✔️
Emilgardis commented 5 months ago

The missing variables are CROSS_TARGETARCH, CROSS_TARGETVARIANT, they are only used in Dockerfile.native and Dockerfile.native.centos

For windows the problem is similar to the issue with qemu-system. We want to not respect the runner, just run it directly.

For wasm I have absolutely no idea :/ (but it's probably the same as windows and qemu-system)

Emilgardis commented 5 months ago

Hmm actually, I might've misspoke there, on windows we do want to run wine, we don't emulate cargo...

We need to preserve WINEPATH and WINEPREFIX, however the error message doesn't make sense to me...

Emilgardis commented 5 months ago

Now thinking about this even more. The issue here is that build.rs is ran on the host right? The problem isn't "cross run --target <target> can't execute a binary compiled for it's own <target> via std::process::Command" right?

If that's the case, the added test case doesn't test correctly, what it should do is compile launch without --target, and since that's probably hard to do, should be done in build script

glehmann commented 5 months ago

The missing variables are CROSS_TARGETARCH, CROSS_TARGETVARIANT, they are only used in Dockerfile.native and Dockerfile.native.centos

this problem should be fixed :-)

For windows the problem is similar to the issue with qemu-system. We want to not respect the runner, just run it directly.

I've changed the test to only use the runner if it's defined in the env var — in fact that's exactly what I did in assert_cmd — and I rolled back my changes to not test qemu-system since they are now passing :-)

glehmann commented 5 months ago

Now thinking about this even more. The issue here is that build.rs is ran on the host right? The problem isn't "cross run --target <target> can't execute a binary compiled for it's own <target> via std::process::Command" right?

the problem is to run everything for the target passed to cross. That may or may not require a runner depending on the virtualisation system used. I think the test does the right thing

I think we are not that far to have everything working :-)

Emilgardis commented 5 months ago

/ci try

github-actions[bot] commented 5 months ago

Starting try run. Link to action

Emilgardis commented 5 months ago

test should use CROSS_FLAGS to correctly use build-std

github-actions[bot] commented 5 months ago

Try run for comment

Failed Jobs

List - [aarch64-unknown-freebsd](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972965349?pr=1420#) - ❌ - [i686-pc-windows-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972971572?pr=1420#) - ❌ - [i686-unknown-freebsd](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972971822?pr=1420#) - ❌ - [mips64el-unknown-linux-muslabi64](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972972990?pr=1420#) - ❌ - [mips64-unknown-linux-muslabi64](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972973697?pr=1420#) - ❌ - [mipsel-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972974222?pr=1420#) - ❌ - [mips-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972974757?pr=1420#) - ❌ - [riscv64gc-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972975930?pr=1420#) - ❌ - [sparcv9-sun-solaris](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972976750?pr=1420#) - ❌ - [thumbv6m-none-eabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972976989?pr=1420#) - ❌ - [thumbv7em-none-eabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972977227?pr=1420#) - ❌ - [thumbv7em-none-eabihf](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972977492?pr=1420#) - ❌ - [thumbv7m-none-eabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972977807?pr=1420#) - ❌ - [thumbv8m.base-none-eabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972978114?pr=1420#) - ❌ - [thumbv8m.main-none-eabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972979059?pr=1420#) - ❌ - [thumbv8m.main-none-eabihf](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972979348?pr=1420#) - ❌ - [wasm32-unknown-emscripten](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972979601?pr=1420#) - ❌ - [x86_64-pc-windows-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972980462?pr=1420#) - ❌ - [x86_64-sun-solaris](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972981013?pr=1420#) - ❌ - [x86_64-unknown-dragonfly](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972981288?pr=1420#) - ❌ - [x86_64-unknown-freebsd](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972981542?pr=1420#) - ❌ - [x86_64-unknown-illumos](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972981816?pr=1420#) - ❌ - [x86_64-unknown-netbsd](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972982801?pr=1420#) - ❌ - [zig](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972983026?pr=1420#) - ❌

Successful Jobs

List - [aarch64-linux-android](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972965063?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-gnu:centos](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972965613?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972965851?pr=1420#step:10:1) - ✔️ - [aarch64-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972966164?pr=1420#step:10:1) - ✔️ - [arm-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972966454?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972966710?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972966990?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972967237?pr=1420#step:10:1) - ✔️ - [arm-unknown-linux-musleabihf](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972967538?pr=1420#step:10:1) - ✔️ - [armv5te-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972967837?pr=1420#step:10:1) - ✔️ - [armv5te-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972968203?pr=1420#step:10:1) - ✔️ - [armv7-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972968538?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972968830?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-gnueabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972969186?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-musleabihf](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972969570?pr=1420#step:10:1) - ✔️ - [armv7-unknown-linux-musleabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972969929?pr=1420#step:10:1) - ✔️ - [cross](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972970261?pr=1420#step:10:1) - ✔️ - [i586-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972970680?pr=1420#step:10:1) - ✔️ - [i586-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972971010?pr=1420#step:10:1) - ✔️ - [i686-linux-android](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972971300?pr=1420#step:10:1) - ✔️ - [i686-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972972098?pr=1420#step:10:1) - ✔️ - [i686-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972972394?pr=1420#step:10:1) - ✔️ - [mips64el-unknown-linux-gnuabi64](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972972653?pr=1420#step:10:1) - ✔️ - [mips64-unknown-linux-gnuabi64](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972973353?pr=1420#step:10:1) - ✔️ - [mipsel-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972973972?pr=1420#step:10:1) - ✔️ - [mips-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972974471?pr=1420#step:10:1) - ✔️ - [powerpc64le-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972975037?pr=1420#step:10:1) - ✔️ - [powerpc64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972975313?pr=1420#step:10:1) - ✔️ - [powerpc-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972975601?pr=1420#step:10:1) - ✔️ - [s390x-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972976185?pr=1420#step:10:1) - ✔️ - [sparc64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972976476?pr=1420#step:10:1) - ✔️ - [thumbv7neon-unknown-linux-gnueabihf](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972978401?pr=1420#step:10:1) - ✔️ - [thumbv7neon-linux-androideabi](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972978743?pr=1420#step:10:1) - ✔️ - [x86_64-apple-darwin](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972979910?pr=1420#step:10:1) - ✔️ - [x86_64-linux-android](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972980189?pr=1420#step:10:1) - ✔️ - [x86_64-pc-windows-msvc](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972980736?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-linux-gnu:centos](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972982057?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-linux-gnu](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972982330?pr=1420#step:10:1) - ✔️ - [x86_64-unknown-linux-musl](https://github.com/cross-rs/cross/actions/runs/7696946866/job/20972982593?pr=1420#step:10:1) - ✔️
glehmann commented 5 months ago

test should use CROSS_FLAGS to correctly use build-std

mmm, I think they are, aren't they?

I don't see what I have changed that makes the bsd systems fail :-/

glehmann commented 5 months ago

for windows, launch.exe, which is launched with wine is able to launch foo.exe directly, without calling wine.

The test fails if I make launch.exe use wine because it can't find the wine executable. So I guess I have to drop the CARGO_TARGET_<target>_RUNNER, so we don't try to use wine if we are already in wine

Emilgardis commented 5 months ago

you removed the if RUN check, that should be there because some of these we can't run on at all