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

compilers/rust: fix sanity_check for Windows targets #14377

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kasper93
Copy link
Contributor

Windows toolchains append .exe to executables. When cross-compiling on Linux, attempting to run ./rusttest will not execute the generated rusttest.exe.

Fix this by always appending .exe, which is a valid filename on all supported platforms. This is what the CLikeCompiler class does too.

While reviewing rust.py, there are opportunities for improvements and better unification with the rest of the Meson code. However, this commit focuses on fixing cross-compilation with minimal changes.

Fixes: #14374

Windows toolchains append `.exe` to executables. When cross-compiling on
Linux, attempting to run `./rusttest` will not execute the generated
`rusttest.exe`.

Fix this by always appending `.exe`, which is a valid filename on all
supported platforms. This is what the `CLikeCompiler` class does too.

While reviewing `rust.py`, there are opportunities for improvements and
better unification with the rest of the Meson code. However, this commit
focuses on fixing cross-compilation with minimal changes.

Fixes: mesonbuild#14374
@kasper93 kasper93 requested a review from dcbaker as a code owner March 16, 2025 23:40
@bonzini bonzini added this to the 1.8 milestone Mar 17, 2025
@bonzini
Copy link
Collaborator

bonzini commented Mar 17, 2025

Matches for example CLikeCompiler._sanity_check_impl:

        # Is a valid executable output for all toolchains and platforms
        binname += '.exe'
        # Write binary check source
        binary_name = os.path.join(work_dir, binname)

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

Successfully merging this pull request may close these issues.

[Rust] sanity check has hardcoded filename, that doesn't include .exe for Windows cross compilation
2 participants