Skip to content

run-make cross-compilation support is questionable #137085

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

Open
Noratrieb opened this issue Feb 15, 2025 · 1 comment
Open

run-make cross-compilation support is questionable #137085

Noratrieb opened this issue Feb 15, 2025 · 1 comment
Assignees
Labels
A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@Noratrieb
Copy link
Member

I observed this in https://github.com/rust-lang-ci/rust/actions/runs/13336646227/job/37253280174.

Basically, when you do rustc() in rmake.rs, it will always compile for the host (unless you explicitly pass a target). This is surprising, because that is not what you asked for when running cross-tests. This means that cross-testing is much less effective than host testing and misses many tests. It is by no means expected that cross-testing will be as good as host testing, but tests incompatible with it should at least be labelled ignore-cross-compile (as many are already) to be clearer about this.

But it's not just a lack of testing, as seen in the CI run above, I got this error when running gnu->musl cross tests:

/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/raw-dylib-elf-verbatim/rmake_out/main: error while loading shared libraries: /lib/x86_64-linux-gnu/libc.so: invalid ELF header

Without investigating it further, it seems like this is caused by rustc() compiling for the host (GNU) while some stuff does correctly use musl.

I suggest that rustc() and other build commands (including native C builds) automatically pass a --target explicitly (or manage to build for the correct target through other means for C). If this is not possible, there should be an error and the test should be marked as ignore-cross-compile to ensure binaries are always compiled for and tested with the correct target.

@Noratrieb Noratrieb added C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 15, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 15, 2025
@jieyouxu jieyouxu added A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 15, 2025
@jieyouxu jieyouxu self-assigned this Feb 15, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Feb 25, 2025

We independently discovered this in #137373 😆 After that PR, we can try to automatically configure --target for rustc invocations, as compiletest should now hopefully only pass the required target directory paths correctly, rather than host + target dirs.

bors added a commit to rust-lang-ci/rust that referenced this issue Mar 5, 2025
[WIP] Enable automatic cross-compilation in run-make tests

This will probably break... a lot of stuff.

Related issue: rust-lang#137085

r? `@ghost`

try-job: test-various-1
try-job: test-various-2
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 5, 2025
[WIP] Enable automatic cross-compilation in run-make tests

This will probably break... a lot of stuff.

Related issue: rust-lang#137085

r? `@ghost`

try-job: test-various
try-job: armhf-gnu
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 5, 2025
[WIP] Enable automatic cross-compilation in run-make tests

This will probably break... a lot of stuff.

Related issue: rust-lang#137085

r? `@ghost`

try-job: test-various
try-job: armhf-gnu
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2025
[WIP] Enable automatic cross-compilation in run-make tests

This will probably break... a lot of stuff.

Related issue: rust-lang#137085

r? `@ghost`

try-job: test-various
try-job: armhf-gnu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
Development

No branches or pull requests

4 participants