Skip to content

run-make cross-compilation support is questionable #137085

Closed
@Noratrieb

Description

@Noratrieb
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.

Activity

added
C-bugCategory: This is a bug.
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
on Feb 15, 2025
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Feb 15, 2025
added
A-compiletestArea: The compiletest test runner
A-run-makeArea: port run-make Makefiles to rmake.rs
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Feb 15, 2025
self-assigned this
on Feb 15, 2025
Kobzol

Kobzol commented on Feb 25, 2025

@Kobzol
Member

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.

added 4 commits that reference this issue on Mar 5, 2025

Auto merge of rust-lang#138066 - Kobzol:runmake-cross-target, r=<try>

Auto merge of rust-lang#138066 - Kobzol:runmake-cross-target, r=<try>

Auto merge of rust-lang#138066 - Kobzol:runmake-cross-target, r=<try>

Auto merge of rust-lang#138066 - Kobzol:runmake-cross-target, r=<try>

Noratrieb

Noratrieb commented on Jul 4, 2025

@Noratrieb
MemberAuthor

woah that's amazing, thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-compiletestArea: The compiletest test runnerA-run-makeArea: port run-make Makefiles to rmake.rsC-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @Kobzol@jieyouxu@rustbot@Noratrieb

      Issue actions

        run-make cross-compilation support is questionable · Issue #137085 · rust-lang/rust