-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Move uclibc under linux #1975
Move uclibc under linux #1975
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (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. Due to 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. |
as of the last round of changes, the |
@kolapapa I see you have other PRs related to uclibc. if you have a real mips or mipsel uclibc system, and don't mind trying to compile this branch for your use case, I would love any feedback. I definitely don't want to break anyone's code! |
Of course, how can I cooperate with you? I have the real system of mips and the target uses |
Would you mind running your code against this branch? I'd be interested in any compilation issues, and definitely any runtime issues you see. |
At the moment, it doesn't seem to be a problem. https://docs.rs/dns-lookup/1.0.5/dns_lookup/fn.getnameinfo.html |
Hmmm, so uclibc defines flags as a uint in <netdb.h>, like so:
However this seems to make uclibc the odd one out in terms of defining this parameter, and since there are dependent crates which require the type to be signed, we can just make libc pretend that it's a signed int. Since it's a flags field it won't really matter. I pushed a change to this branch to address this. Would you mind checking again? |
So far everything is normal. clap = { version = "2.33.0", features = ["yaml"] }
tokio = { version = "0.2", features = ["full"] }
reqwest = { version = "0.10.4", features = ["json", "blocking"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
regex = "1.3"
telnet = "0.1.4"
glob = "0.3.0"
lazy_static = "1.4.0"
log = "0.4"
pretty_env_logger = "0.4.0"
anyhow = "1.0.27"
crossbeam-queue = "0.2.1"
config = "0.10.1"
futures = "0.3.4"
trust-dns-resolver = "0.19.4"
url = "2.1.1"
dns-lookup = "1.0.5" |
@kolapapa Great news. That's super helpful, thanks! |
☔ The latest upstream changes (presumably #1979) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
aafc9be
to
1e25976
Compare
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author |
Since this is mostly moving code around, this should make the PR a lot easier to review: rust-lang/rust#76268 (comment) |
(Note that we haven't built any consensus on moving yet.) |
Hello @JohnTitor! I realize you are quite busy. I wanted to reach out and ask if there is a way that I can help move this conversation forward. I know it's a big change. It's almost entirely out of the tier-1/2 space, and I will have the ability to maintain this area of the code long-term. It would allow crates like |
So, generally, I'd avoid moving the code without a strong reason to keep git-history consistent. If this PR can simplify our codebase and structure, however, I'm happy to accept it. In this case, most changes look fine but I'd like to:
|
Thanks much for the reply! That all makes sense, and I'll work on what you suggested. For CI, there are no official builds of |
@skrap instead of building a self-hosted rustc (which like you mentioned will take forever), can you cross-compile with -Z build-std? That should have reasonable compile times. |
I will try that! |
@jyn514 Sadly I don't think that's going to work. There's a chicken & egg problem here:
So, nightly rust can't There's seemingly no way to get |
Hmm, you shouldn't need all of libstd, just core - and actually, looking at https://github.com/rust-lang/libc/blob/master/src/lib.rs#L19-L23 you might not even need core. If you remove |
Sadly no, but I suspect I'm doing it wrong:
|
@skrap I would rather not debug this on github, the 10 minute back and forth is pretty painful. Feel free to hop on the discord in #contribute or Zulip and I'm happy to help out. |
So it seems that since rustup does not currently provide nightlies for any of the uclibc targets, I don't see any way to get this into CI without building a full rust in CI. I'm out of answers for how to proceed on CI, so I will work on the other tasks. Once this change lands in nightly, and libc can once again build against uclibc, I will take up the CI issue again. (Unless someone has ideas for a different workaround.) |
So, is it difficult to fix a libc build (and bump its version on rust-lang/rust) first then move items? If it's some simple work, I think it's one of the good ways. If not, then I'm fine to review/merge this one. |
Ok, after some consulting with @jyn514 and others I was informed that I could build libc via build-std! So I'll work on using that to have CI at least build libc. I think it's probably worth it to have the tests run in CI as well but that will have to come later, once libc-test can build against nightly rust. |
Todo still:
|
☔ The latest upstream changes (presumably #1993) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
3c5226f
to
10693b4
Compare
I have made a commit to fix the l4re build, but I am not able to test it. It's correct to the best of my knowledge, but hopefully someone from L4Re will speak up. The L4Re target is tier 2, and unfortunately there's no CI set up for running the libc-test tests. @bors try |
Move uclibc under linux This is a first cut at moving uclibc under linux, alongside `musl` and `gnu`. All tests pass on a vexpress a9 running in qemu. I am working on testing the other tier 3 uclibc targets: `mips-unknown-linux-uclibc` and `mipsel-unknown-linux-uclibc`. ~Not having access to these platforms, I am working on getting them running in qemu, but it may take a bit.~ The style check doesn't pass. I would appreciate some direction here. Many of these constants are defined under 2-of-3 out of musl/glibc/uclibc, so I'm not sure whether I should transform: ```rust #[cfg(not(target_env = "uclibc"))] pub fn foo(); ``` into 2 separate declarations, one each in `musl/mod.rs` and `gnu/mod.rs` or use a `cfg_if` block for each one (which explodes 2 lines into 5). - [x] Help me choose which fix to use for the items defined in musl and gnu but not uclibc. It's my guess that exploding into the `cfg_if` block is better for long-term maintainability, but I'd really appreciate opinions from the maintainers.
☀️ Try build successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13 |
Thanks for reaching out. I will have a llok at the weekend, but unfortunately
I won't make it earlier.
|
I took some time and read the changes. Unfortunately, I am not in a position
to test the changes, ATM. L4Re uses a fork of Uclibc, tha has, to my
knowledge, not been updated for a while. There's a high chance that
assumptions on your uclibc version do not hold. I only have an old snapshot
around (2 years old) and lack the time to check out what L4Re is doing these
days. I would suggest that you just continue and we hand in a PR in case
something breaks in a newer version of L4Re.
|
Thanks @humenda. @JohnTitor sounds like the work here is complete! |
10693b4
to
cd5c1e7
Compare
Oh sorry, missed the ping. Seems uclibc target doesn't have std component and we cannot run semver check for it (https://github.com/rust-lang/libc/runs/1697567233). So 9aad8ac is now meaningless, r=me once it's dropped. |
936fab0
to
3378f0c
Compare
Thanks! |
📌 Commit 3378f0c has been approved by |
☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13 |
Thank you! All of your time reviewing and shepherding this change was very much appreciated, and I am looking forward to seeing this change in production rust! 🥳 |
This is a first cut at moving uclibc under linux, alongside
musl
andgnu
.All tests pass on a vexpress a9 running in qemu. I am working on testing the other tier 3 uclibc targets:
mips-unknown-linux-uclibc
andmipsel-unknown-linux-uclibc
.Not having access to these platforms, I am working on getting them running in qemu, but it may take a bit.The style check doesn't pass. I would appreciate some direction here. Many of these constants are defined under 2-of-3 out of musl/glibc/uclibc, so I'm not sure whether I should transform:
into 2 separate declarations, one each in
musl/mod.rs
andgnu/mod.rs
or use acfg_if
block for each one (which explodes 2 lines into 5).It's my guess that exploding into the
cfg_if
block is better for long-term maintainability, but I'd really appreciate opinions from the maintainers.