-
Notifications
You must be signed in to change notification settings - Fork 8
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 compilation (of libc) on MacOS fails #66
Labels
S-needs-investigation
Status: needs investigation
upstream
An issue with the standard library itself or its dependencies.
Comments
It also failed on a musl system |
A workaround for this is: export RUSTFLAGS="-Lnative=/usr/lib" (replace And a fix would be like rust-lang/libc#1327 plus some adjustment in rustbuild like rust-lang/rust#85600 to copy |
This was referenced Jul 5, 2021
This also happens for me on x86_64-unknown-linux-gnu; you can clearly see that it tries to compile core and std from the wrong toolchain. |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Nov 3, 2021
Provide standalone libc.a in self-contained for musl and wasi This is a prerequisites of rust-lang/libc#2272, which in turn fix: - rust-lang/wg-cargo-std-aware#66 - rust-lang#89626
bors
added a commit
to rust-lang/libc
that referenced
this issue
Nov 4, 2021
Use link modifiers -bundle on musl and wasi target Implement rust-lang/rust#72274 Fix: - rust-lang/wg-cargo-std-aware#66 - rust-lang/rust#89626 TODO: - [x] Implement rustbuild side change: rust-lang/rust#90527
bors
added a commit
to rust-lang/libc
that referenced
this issue
Nov 4, 2021
Use link modifiers -bundle on musl and wasi target Implement rust-lang/rust#72274 Fix: - rust-lang/wg-cargo-std-aware#66 - rust-lang/rust#89626 TODO: - [x] Implement rustbuild side change: rust-lang/rust#90527
bors
added a commit
to rust-lang/libc
that referenced
this issue
Nov 4, 2021
Use link modifiers -bundle on musl and wasi target Implement rust-lang/rust#72274 Fix: - rust-lang/wg-cargo-std-aware#66 - rust-lang/rust#89626 TODO: - [x] Implement rustbuild side change: rust-lang/rust#90527
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-needs-investigation
Status: needs investigation
upstream
An issue with the standard library itself or its dependencies.
I'm cross compiling for a linux musl target on MacOS, using the latest version of the homebrew musl-cross package.
This works fine for normal work I do.
However, when attempting to do a standard build, the libc rust crate fails with
error: could not find native static library
c, perhaps an -L flag is missing?
. Rightly so, as it has been linked added as a dependency torustc
command line (long trace below).This is because libc is odd; it doesn't emit use
cargo:rustc-link-search
in it's build script,build.rs
. A patch to do this back in 2015 was rejected because it's 'fixed upstream' (rust-lang/libc#17) in rust itself (rust-lang/rust@52862e4). I have to say, I didn't follow this reasoning.This is a place where one would like to inject a custom flag - I know where and how to search for the libc - but I can only do so by modifying
RUSTFLAGS
, which affects everything else being built. Of course, I could write a rustc wrapper script, do a bit of argument sense checking, and then call rustc, but that's... work. (As an aside, when doing controlled, reproducible builds, I do this a lot, unsettingPATH
and then providing shim wrappers for tools until I build up a profile of what's needed to do a reproducible build, especially if build tools calldate
and the like).This seems related to #14 and other issues.
The text was updated successfully, but these errors were encountered: