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

build.rs: always use freebsd12 when rustc_dep_of_std is set #3723

Merged
merged 1 commit into from
Jun 15, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented May 26, 2024

Currently, when rustc_dep_of_std is set, the freebsd version used depends on the return value of which_freebsd():

  • if it is Some(12), it uses freebsd12
  • otherwise it uses freebsd11

That does not seem intended? It is certainly rather odd that when building on FreeBSD 13 we'd get the freebsd11 API, but when building on FreeBSD 12 we get freebsd12. This also causes some "fun" for Miri when cross-building the freebsd std on other targets: which_freebsd() then returns None, so std uses different symbols than it does in the std that is shipped by rustup.

I assume the intention of #3434 was to force std to use freebsd12 when rustc_dep_of_std is set (at least that's what the comments seem to say), so let's implement that.

@rustbot
Copy link
Collaborator

rustbot commented May 26, 2024

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) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@RalfJung RalfJung force-pushed the buildrs-freebsd branch 2 times, most recently from 8dabe1d to b3d5f22 Compare May 26, 2024 18:54
build.rs Outdated Show resolved Hide resolved
@JohnTitor JohnTitor added this pull request to the merge queue Jun 15, 2024
Merged via the queue into rust-lang:main with commit 399c6ce Jun 15, 2024
41 checks passed
@RalfJung RalfJung deleted the buildrs-freebsd branch July 24, 2024 19:00
@RalfJung
Copy link
Member Author

@JohnTitor any chance of seeing a libc release with this change any time soon? That should allow a bit of cleanup in Miri. :)

@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Aug 13, 2024
@RalfJung
Copy link
Member Author

Oh, I didn't realize that the branch for releases on crates.io is separate from main... should I just create a version of this PR against the libc-0.2 branch or how does that work?

@tgross35
Copy link
Contributor

tgross35 commented Aug 17, 2024

The branches are unfortunately pretty divergent, so I have just been requesting everyone to always target main and, if it should be backported, @rustbot label +stable-nominated. I cherry pick them in batches.

I'll get this into a release within the next couple of days.

@RalfJung
Copy link
Member Author

RalfJung commented Aug 17, 2024 via email

tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Aug 17, 2024
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Aug 17, 2024
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Aug 17, 2024
@tgross35
Copy link
Contributor

@RalfJung this should be available in 0.2.157 now

match which_freebsd() {
Some(10) if libc_ci => set_cfg("freebsd10"),
Some(11) if libc_ci => set_cfg("freebsd11"),
Some(12) if libc_ci || rustc_dep_of_std => set_cfg("freebsd12"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized the previous logic for rustc_dep_of_std here wasn't what I thought it was...

The logic was: if the auto-detected version is 12 and rustc_dep_of_std is set, then use freebsd12. If the auto-detected version is anything else and rustc_dep_of_std is set, use freebsd11. If this was deliberate, I don't understand why, and it doesn't match the comments.

With my PR, the logic now is: if rustc_dep_of_std is set, don't even auto-detect, just use version 12. This matches what the comments already said before.

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 18, 2024
library: bump libc dependency

This pulls in rust-lang/libc#3723, which hopefully unblocks rust-lang/miri#3748.
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 19, 2024
library: bump libc dependency

This pulls in rust-lang/libc#3723, which hopefully unblocks rust-lang/miri#3748.
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 20, 2024
library: bump libc dependency

This pulls in rust-lang/libc#3723, which hopefully unblocks rust-lang/miri#3748.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 20, 2024
library: bump libc dependency

This pulls in rust-lang/libc#3723, which hopefully unblocks #3748.
bors added a commit to rust-lang/miri that referenced this pull request Aug 20, 2024
readdir_r shim: assume FreeBSD v12+

Blocked on rust-lang/libc#3723 being released and propagating to std.
bors added a commit to rust-lang/miri that referenced this pull request Aug 20, 2024
readdir_r shim: assume FreeBSD v12+

Blocked on rust-lang/libc#3723 being released and propagating to std.
RalfJung pushed a commit to RalfJung/rust that referenced this pull request Aug 22, 2024
readdir_r shim: assume FreeBSD v12+

Blocked on rust-lang/libc#3723 being released and propagating to std.
asomers added a commit to asomers/libc that referenced this pull request Sep 23, 2024
Commit 7437d0a erroneously defined it as "ulong" instead of u64.
Nobody noticed the mistake, probably because it was only tested on
64-bit architectures, where those are equivalent.  But it's a problem
now, after rust-lang#3723 , which switched the standard library to a FreeBSD 12
ABI.

Issue rust-lang/rust#130677
asomers added a commit to asomers/libc that referenced this pull request Sep 23, 2024
The original definitions were never correct.  But nobody noticed because
we don't do CI on 32-bit FreeBSD.  The problem is apparent now due to
 rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12
ABI.

Fixes rust-lang/rust#130677
asomers added a commit to asomers/libc that referenced this pull request Sep 23, 2024
The original definitions were never correct.  But nobody noticed because
we don't do CI on 32-bit FreeBSD.  The problem is apparent now due to
 rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12
ABI.

Fixes rust-lang/rust#130677
asomers added a commit to asomers/libc that referenced this pull request Sep 23, 2024
The original definitions were never correct.  But nobody noticed because
we don't do CI on 32-bit FreeBSD.  The problem is apparent now due to
 rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12
ABI.

Fixes rust-lang/rust#130677
github-merge-queue bot pushed a commit that referenced this pull request Sep 25, 2024
* Fix the definition of ino_t on 32-bit FreeBSD 12+

Commit 7437d0a erroneously defined it as "ulong" instead of u64.
Nobody noticed the mistake, probably because it was only tested on
64-bit architectures, where those are equivalent.  But it's a problem
now, after #3723 , which switched the standard library to a FreeBSD 12
ABI.

Issue rust-lang/rust#130677

* Fix the definition of "struct stat" on 32-bit FreeBSD 12+

The original definitions were never correct.  But nobody noticed because
we don't do CI on 32-bit FreeBSD.  The problem is apparent now due to
 #3723 , which caused the nightly toolchain to switch to a FreeBSD 12
ABI.

Fixes rust-lang/rust#130677

* fixup: fix build on powerpc, powerpc64, and arm
asomers added a commit to asomers/libc that referenced this pull request Sep 27, 2024
Commit 7437d0a erroneously defined it as "ulong" instead of u64.
Nobody noticed the mistake, probably because it was only tested on
64-bit architectures, where those are equivalent.  But it's a problem
now, after rust-lang#3723 , which switched the standard library to a FreeBSD 12
ABI.

Issue rust-lang/rust#130677
asomers added a commit to asomers/libc that referenced this pull request Sep 27, 2024
The original definitions were never correct.  But nobody noticed because
we don't do CI on 32-bit FreeBSD.  The problem is apparent now due to
 rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12
ABI.

Fixes rust-lang/rust#130677
asomers added a commit to asomers/libc that referenced this pull request Sep 29, 2024
Commit 7437d0a erroneously defined it as "ulong" instead of u64.
Nobody noticed the mistake, probably because it was only tested on
64-bit architectures, where those are equivalent.  But it's a problem
now, after rust-lang#3723 , which switched the standard library to a FreeBSD 12
ABI.

Issue rust-lang/rust#130677
asomers added a commit to asomers/libc that referenced this pull request Sep 29, 2024
The original definitions were never correct.  But nobody noticed because
we don't do CI on 32-bit FreeBSD.  The problem is apparent now due to
 rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12
ABI.

Fixes rust-lang/rust#130677
asomers added a commit to asomers/libc that referenced this pull request Oct 2, 2024
Commit 7437d0a erroneously defined it as "ulong" instead of u64.
Nobody noticed the mistake, probably because it was only tested on
64-bit architectures, where those are equivalent.  But it's a problem
now, after rust-lang#3723 , which switched the standard library to a FreeBSD 12
ABI.

Issue rust-lang/rust#130677
asomers added a commit to asomers/libc that referenced this pull request Oct 2, 2024
The original definitions were never correct.  But nobody noticed because
we don't do CI on 32-bit FreeBSD.  The problem is apparent now due to
 rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12
ABI.

Fixes rust-lang/rust#130677
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review stable-applied This PR has been cherry-picked to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants