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

Add build script and LIBC_PATH environ variable #17

Closed
wants to merge 1 commit into from

Conversation

tailhook
Copy link

@tailhook tailhook commented Aug 5, 2015

Well, the solution here is probably not optimal. But it's the easiest way I've found so far to build libc (as dependency) for x86_64-unknown-linux-musl.

The problem is that when building with musl, the target libc is not the one in default path. So I get output similar to:

error: could not find native static library `c`, perhaps an -L flag is missing?
Could not compile `libc`.

Caused by:
  Process didn't exit successfully: `rustc libc/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature="cargo-build" --cfg feature="default" -C metadata=49eeab76b364dec9 
-C extra-filename=-49eeab76b364dec9 --out-dir /work/target/x86_64-unknown-linux-musl/debug/deps --emit=dep-info,link --target x86_64-unknown-linux-musl -L dependency=/work/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/work/target/x86_64-unknown-linux-musl/debug/deps`

According to cargo docs the build.rs script is there suited to find dependencies (or sometimes build one if not found). So with this script setting env var to LIBC_PATH=/usr/local/musl/lib I can now build my project.

Any other ideas of how to build the lib are appreciated.

This helps building binaries with alternate libc, in particular musl
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

Thanks for the PR! This was actually fixed upstream and we just need to update libc to pick up the change. We haven't updated yet because there was a breaking change in liblibc.

@tailhook
Copy link
Author

@alexcrichton So how do you recommend to build libc now? It's also not clear what stops you to update now? Is it incompatibility in "nix" crate? And when do you plan to upgrade?

@alexcrichton
Copy link
Member

Lack of time to deal with this right now stops the update unfortunately.

dlrobertson pushed a commit to dlrobertson/libc that referenced this pull request Oct 31, 2017
Add build script for GNU make, which compiles (but doesn't work yet)
bors pushed a commit that referenced this pull request Sep 26, 2019
Sync to rust-lang/libc branch master
lvllvl added a commit to lvllvl/libc that referenced this pull request Jan 7, 2025
# This is the 1st commit message:

chore: add labels to FIXMEs

# This is the commit message rust-lang#2:

change label for .field FIXMEs
# This is the commit message rust-lang#3:

add fixme csv

# This is the commit message rust-lang#4:

Update fixmes.csv
# This is the commit message rust-lang#5:

Update fixmes.csv
# This is the commit message rust-lang#6:

Update fixmes.csv
# This is the commit message rust-lang#7:

Update fixmes.csv
# This is the commit message rust-lang#8:

Update fixmes.csv
# This is the commit message rust-lang#9:

Update fixmes.csv
# This is the commit message rust-lang#10:

Update fixmes.csv
# This is the commit message rust-lang#11:

Update fixmes.csv
# This is the commit message rust-lang#12:

Update fixmes.csv
# This is the commit message rust-lang#13:

Update fixmes.csv
# This is the commit message rust-lang#14:

Update fixmes.csv
# This is the commit message rust-lang#15:

Update fixmes.csv
# This is the commit message rust-lang#16:

Update fixmes.csv
# This is the commit message rust-lang#17:

Update fixmes.csv
# This is the commit message rust-lang#18:

updates to csv

# This is the commit message rust-lang#19:

Update fixmes.csv
# This is the commit message rust-lang#20:

Update fixmes.csv
# This is the commit message rust-lang#21:

Update fixmes.csv
# This is the commit message rust-lang#22:

Update fixmes.csv remove hurd"
# This is the commit message rust-lang#23:

Update fixmes.csv remove "'s
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.

4 participants