-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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-compiling from aarch64 to x86_64 fails (unrecognized command-line option '-m64) #119500
Comments
"g++-x86-64-linux-gnu" is the cross-compiler to x86_64 - so you want This is enough to get However something's not quite adding up since https://packages.debian.org/stable/devel/g++-12-aarch64-linux-gnu isn't even available for aarch64 since it's a cross compiler TO aarch64. Are you definitely running docker on an aarch64 host? |
@adamgemmell Thanks Adam, that seems to work! It seems you're right about the package; apt performs a substitution:
I feel it would make sense to make cross-compilation easier, by auto-detecting cross-platform, using relevant search paths, and auto-detecting missing dependencies? But that's a separate issue for the I will close this issue. |
@erikschul -m64 is a separate command line option from -march. The former enables code generation for x86-64, while the latter chooses a version of x86-64 to target. -mcpu is even more specific, letting you choose a certain CPU to optimise for. I think you're also mixing up the flags - |
Setup code
The runner should ideally setup correctly on either platform, and compile to either target.
Using debian12, running in docker.
Using cross is not an option (docker-in-docker etc.).
Error
fails with
which makes sense if it's using cc, which only supports these targets:
cc -E -march=help -xc /dev/null
So I tried installing x86-64 gcc and setting it:
but its valid targets are:
so I need to change the target to
-mx86-64
.I tried overriding with
RUSTFLAGS
but that didn't work.Problem
-m
target?Alternatives
It works with zigbuild: (I haven't tried to run the x86_64 binary)
The text was updated successfully, but these errors were encountered: