-
Notifications
You must be signed in to change notification settings - Fork 84
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
Cannot cross-compile Rust target from Apple M1 -> x86_64-linux-gnu #365
Comments
From a cursory glance this looks to be a similar issue to #303 (though with Rust rather than C++). Essentially, the default The references to build triples and constraints are a little misleading here. They influence Bazel during toolchain resolution, but do not make the underlying |
Thanks @benradf, that makes sense! Is there anyway I can unblock myself while waiting for that? Not really a Nix expert myself, I'm not sure how to change
My
The link above seems to be more how to set up |
So I haven't had time to try this properly but I think if you change:
to
here in Of course, you can't directly change Note that this will break non-cross-compilation scenarios, but if you can get cross-compilation working first we can then look at doing it in a way that supports both. PS: Before making any Bazel changes you should probably see if you can get Nix to build you a cross-compiler:
|
Closing this as it's a specific instance of the more general Better API for cross-compilation support issue. |
Describe the bug
I'm following the example here with some changes in order to compile a Rust binary (I'm using Apple M1 macbook) for a Docker image (linux-amd64/x86_64).
rules_docker
image transition is enabled to select the correct target platform.However, the compilation fail with:
I'm not even sure why but the 2 compiler versions are exactly the same. if I changed the version of
RUST_VERSION
in myWORKSPACE
to something else, like1.68.2
I still got the same error, but this time one of the 2 compiler versions display1.68.2
instead.Is this somehow an issue with rust toolchain having one version and Nix toolchain with another version of the compiler and the 2 conflicts with each other?
To Reproduce
My
WORKSPACE
is almost exactly the same as in the provided Rust example. The major difference is I addexec_constraints
andtarget_constraints
to bothnixpkgs_cc_configure
andnixpkgs_rust_configure
in order to targetlinux-x86_64
.Here's the relevant section in
WORKSPACE
to set up Nix + Rust:My
.bazelrc
is:I use rule
rust_image
fromrules_docker
which references anotherrust_binary
target, but when I try to runbazel run ${my_rust_image_target}
I got the above error.Expected behavior
Cross compilation should work from Apple M1 execution platform -> linux-amd64 as a target platform.
Environment
The text was updated successfully, but these errors were encountered: