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

Do not use LFS64 on linux with musl #106246

Closed
wants to merge 1 commit into from
Closed

Conversation

kraj
Copy link
Contributor

@kraj kraj commented Dec 29, 2022

glibc is providing open64 and other lfs64 functions but musl aliases them to normal equivalents since off_t is always 64-bit on musl, therefore check for target env along when target OS is linux before using open64, this is more available. Latest Musl has made these namespace changes [1]

[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4

@rustbot
Copy link
Collaborator

rustbot commented Dec 29, 2022

r? @thomcc

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 29, 2022
@rustbot
Copy link
Collaborator

rustbot commented Dec 29, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@thomcc
Copy link
Member

thomcc commented Dec 29, 2022

@rustbot author

Please use at-rustbot ready to push it back into my review queue when it is ready.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 29, 2022
@JohnCSimon
Copy link
Member

@kraj
Ping from triage - can you please address the reviewer's comments?

@bors
Copy link
Contributor

bors commented Mar 2, 2023

☔ The latest upstream changes (presumably #106673) made this pull request unmergeable. Please resolve the merge conflicts.

@kraj
Copy link
Contributor Author

kraj commented Mar 3, 2023

@kraj Ping from triage - can you please address the reviewer's comments?

yeah I need to find time to rework this.

@alyssais alyssais mentioned this pull request May 2, 2023
47 tasks
@alyssais
Copy link
Contributor

Any news here? This is our main barrier to upgrading to musl 1.2.4 in Nixpkgs.

glibc is providing open64 and other lfs64 functions but musl aliases
them to normal equivalents since off_t is always 64-bit on musl,
therefore check for target env along when target OS is linux before
using open64, this is more available. Latest Musl has made these
namespace changes [1]

[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4

Signed-off-by: Khem Raj <[email protected]>
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    |
299 | pub struct DirEntry {
    | ------------------- previous definition of the type `DirEntry` here
...
336 | pub struct DirEntry {
    | ^^^^^^^^^^^^^^^^^^^ `DirEntry` redefined here
    |
    = note: `DirEntry` must be defined only once in the type namespace of this module
error[E0432]: unresolved import `libc::fstatat64`
  --> /checkout/library/std/src/sys/unix/fs.rs:57:5
   |
57 | use libc::fstatat64;
57 | use libc::fstatat64;
   |     ^^^^^^---------
   |     |     |
   |     |     help: a similar name exists in the module: `fstatat`
   |     no `fstatat64` in the root

error[E0432]: unresolved imports `libc::dirent64`, `libc::fstat64`, `libc::ftruncate64`, `libc::lseek64`, `libc::lstat64`, `libc::off64_t`, `libc::open64`, `libc::stat64`
    |
    |
106 | use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64};
    |            |         |        |            |        |        |        |
    |            |         |        |            |        |        |        no `open64` in the root
    |            |         |        |            |        |        no `off64_t` in the root
    |            |         |        |            |        no `lstat64` in the root
    |            |         |        |            |        no `lstat64` in the root
    |            |         |        |            no `lseek64` in the root
    |            |         |        no `ftruncate64` in the root
    |            |         no `fstat64` in the root
    |            no `dirent64` in the root
help: a similar name exists in the module
    |
    |
106 | use libc::{dirent, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64};
help: a similar name exists in the module
    |
    |
106 | use libc::{dirent64, fstat, ftruncate64, lseek64, lstat64, off64_t, open64, stat64};
help: a similar name exists in the module
    |
    |
106 | use libc::{dirent64, fstat64, ftruncate, lseek64, lstat64, off64_t, open64, stat64};
help: a similar name exists in the module
    |
    |
106 | use libc::{dirent64, fstat64, ftruncate64, lseek, lstat64, off64_t, open64, stat64};
help: a similar name exists in the module
    |
    |
106 | use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat, off64_t, open64, stat64};
help: a similar name exists in the module
    |
    |
106 | use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off_t, open64, stat64};
help: a similar name exists in the module
    |
    |
106 | use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open, stat64};
help: a similar name exists in the module
    |
    |
106 | use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat};

error[E0412]: cannot find type `dirent64_min` in this scope
    --> /checkout/library/std/src/sys/unix/fs.rs:301:12
     |
     |
301  |       entry: dirent64_min,
     |              ^^^^^^^^^^^^ help: a struct with a similar name exists: `dirent64`
     |
    ::: /cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.143/src/unix/bsd/apple/mod.rs:1105:1
     |
1105 | / s_no_extra_traits! {
1106 | |     #[cfg_attr(libc_packedN, repr(packed(4)))]
1107 | |     pub struct kevent {
1108 | |         pub ident: ::uintptr_t,
1383 | |     }
1384 | | }
     | |_- similarly named struct `dirent64` defined here


error[E0063]: missing field `name` in initializer of `sys::unix::fs::DirEntry`
   --> /checkout/library/std/src/sys/unix/fs.rs:768:27
    |
768 |             let mut ret = DirEntry { entry: mem::zeroed(), dir: Arc::clone(&self.inner) };
    |                           ^^^^^^^^ missing `name`
Some errors have detailed explanations: E0063, E0412, E0428, E0432.
For more information about an error, try `rustc --explain E0063`.
error: could not compile `std` (lib) due to 5 previous errors
fatal error: failed to build sysroot: sysroot build failed

orbea added a commit to orbea/gentoo that referenced this pull request May 28, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

At this point USE=system-boostrap will be required with >= musl-1.2.4
until uptream merges these patches and updates their boostrap.

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jun 1, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

At this point USE=system-boostrap will be required with >= musl-1.2.4
until uptream merges these patches and updates their boostrap.

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jun 5, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

At this point USE=system-boostrap will be required with >= musl-1.2.4
until uptream merges these patches and updates their boostrap.

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jun 5, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

At this point USE=system-boostrap will be required with >= musl-1.2.4
until uptream merges these patches and updates their boostrap.

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jun 8, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

At this point USE=system-boostrap will be required with >= musl-1.2.4
until uptream merges these patches and updates their boostrap.

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jun 8, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

At this point USE=system-boostrap will be required with >= musl-1.2.4
until uptream merges these patches and updates their boostrap.

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jun 9, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

At this point USE=system-boostrap will be required with >= musl-1.2.4
until uptream merges these patches and updates their boostrap.

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jun 29, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

At this point USE=system-boostrap will be required with >= musl-1.2.4
until uptream merges these patches and updates their boostrap.

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jul 16, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jul 17, 2023
This fixes the build with musl-1.2.4, for those that are still
experiencing issues these steps should resolve them:

1. Downgrade to musl-1.2.3
2. Rebuild dev-lang/rust with these patches
3. Upgrade to musl-1.2.4 again
4. Rebuild rust with USE=system-bootstrap

This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jul 20, 2023
This fixes the build with musl-1.2.4, may need -system-bootstrap after
updating musl.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-Commit: rust-lang/libc@1e8c55c
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
orbea added a commit to orbea/gentoo that referenced this pull request Jul 21, 2023
This fixes the build with musl-1.2.4, may need -system-bootstrap after
updating musl.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-Commit: rust-lang/libc@1e8c55c
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
@Dylan-DPC
Copy link
Member

@kraj any updates on this?

orbea added a commit to orbea/gentoo that referenced this pull request Aug 7, 2023
This fixes the build with musl-1.2.4, may need -system-bootstrap after
updating musl.

Closes: https://bugs.gentoo.org/903607
Upstream-PR: rust-lang/rust#106246
Upstream-Issue: rust-lang/libc#2934
Upstream-PR: rust-lang/libc#2935
Upstream-Commit: rust-lang/libc@1e8c55c
Upstream-PR: rust-random/getrandom#326
Upstream-Commit: rust-random/getrandom@7f73e3c
Signed-off-by: orbea <[email protected]>
@git-bruh
Copy link
Contributor

Hey, can I take over this PR?

@Dylan-DPC
Copy link
Member

@git-bruh sure feel free to submit a new pr and link to this one

@kraj
Copy link
Contributor Author

kraj commented Sep 19, 2023

Hey, can I take over this PR?

Please go ahead I won’t have time soon to work on it

@Dylan-DPC Dylan-DPC closed this Oct 12, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 28, 2023
Don't use LFS64 symbols on musl

Supersedes rust-lang#106246

~~Note to packagers: If your distro's musl package has already been updated, then you won't be able to build a newer version of rust until a new rust release is made with these changes merged (which can be used to bootstrap). I'm using a super hacky method to bypass this by creating a stub library with LFS64 symbols and building a patched rust, so the symbols satisfy the build requirements while the final compiler build has no references to LFS64 symbols, example: https://codeberg.org/kiss-community/repo/pulls/160/files~~ Doesn't seem to be necessary with new rustup nightly builds, likely due to updates to vendored crates

cc `@alyssais`
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Oct 29, 2023
Don't use LFS64 symbols on musl

Supersedes rust-lang#106246

~~Note to packagers: If your distro's musl package has already been updated, then you won't be able to build a newer version of rust until a new rust release is made with these changes merged (which can be used to bootstrap). I'm using a super hacky method to bypass this by creating a stub library with LFS64 symbols and building a patched rust, so the symbols satisfy the build requirements while the final compiler build has no references to LFS64 symbols, example: https://codeberg.org/kiss-community/repo/pulls/160/files~~ Doesn't seem to be necessary with new rustup nightly builds, likely due to updates to vendored crates

cc `@alyssais`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 29, 2023
Don't use LFS64 symbols on musl

Supersedes rust-lang#106246

~~Note to packagers: If your distro's musl package has already been updated, then you won't be able to build a newer version of rust until a new rust release is made with these changes merged (which can be used to bootstrap). I'm using a super hacky method to bypass this by creating a stub library with LFS64 symbols and building a patched rust, so the symbols satisfy the build requirements while the final compiler build has no references to LFS64 symbols, example: https://codeberg.org/kiss-community/repo/pulls/160/files~~ Doesn't seem to be necessary with new rustup nightly builds, likely due to updates to vendored crates

cc ``@alyssais``
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 29, 2023
Don't use LFS64 symbols on musl

Supersedes rust-lang#106246

~~Note to packagers: If your distro's musl package has already been updated, then you won't be able to build a newer version of rust until a new rust release is made with these changes merged (which can be used to bootstrap). I'm using a super hacky method to bypass this by creating a stub library with LFS64 symbols and building a patched rust, so the symbols satisfy the build requirements while the final compiler build has no references to LFS64 symbols, example: https://codeberg.org/kiss-community/repo/pulls/160/files~~ Doesn't seem to be necessary with new rustup nightly builds, likely due to updates to vendored crates

cc ```@alyssais```
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 29, 2023
Rollup merge of rust-lang#115968 - git-bruh:master, r=workingjubilee

Don't use LFS64 symbols on musl

Supersedes rust-lang#106246

~~Note to packagers: If your distro's musl package has already been updated, then you won't be able to build a newer version of rust until a new rust release is made with these changes merged (which can be used to bootstrap). I'm using a super hacky method to bypass this by creating a stub library with LFS64 symbols and building a patched rust, so the symbols satisfy the build requirements while the final compiler build has no references to LFS64 symbols, example: https://codeberg.org/kiss-community/repo/pulls/160/files~~ Doesn't seem to be necessary with new rustup nightly builds, likely due to updates to vendored crates

cc ```@alyssais```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants