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

Update use of libc::timespec to prepare for future libc version #363

Merged
merged 1 commit into from Nov 29, 2022

Conversation

wesleywiser
Copy link
Contributor

@wesleywiser wesleywiser commented Nov 22, 2022

In a future release of the libc crate, libc::timespec will contain private padding fields on 32-bit *-linux-musl targets and so the struct will no longer be able to be created using the literal initialization syntax.

Update the use of libc::timespec to create a value by calling std::mem::zeroed() first and then setting the tv_sec and tv_nsec fields manually which works with both current versions of libc as well as the future version which contains that change.

See also rust-lang/libc#2088

@wesleywiser
Copy link
Contributor Author

I don't know why this is failing on macos but it looks unrelated to this change:

  = note: ld: in /Users/runner/.rustup/toolchains/1.49.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-f52081aedccc205f.rlib(lib.rmeta), archive member 'lib.rmeta' with length 31176 is not mach-o or llvm bitcode file '/Users/runner/.rustup/toolchains/1.49.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-f52081aedccc205f.rlib'
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

@bjorn3
Copy link
Contributor

bjorn3 commented Nov 23, 2022

All rustc versions before 1.54 are broken with the latest XCode version as the linker no longer accepts non-object files in archives. rust-lang/rust#84449 which landed in 1.54 started wrapping the crate metadata in an object file. See rust-lang/rust#103044 for more info.

@Amanieu
Copy link
Owner

Amanieu commented Nov 25, 2022

CI should be fixed now, can you rebase?

In a future release of the `libc` crate, `libc::timespec` will contain
private padding fields on `*-linux-musl` targets and so the struct will
no longer be able to be created using the literal initialization syntax.

Update the use of `libc::timespec` to create a value by calling
`std::mem::zeroed()` first and then setting the `tv_sec` and `tv_nsec`
fields manually which works with both current versions of `libc` as well
as the future version which contains that change.
@wesleywiser
Copy link
Contributor Author

Sure, rebased!

@wesleywiser
Copy link
Contributor Author

Looks like CI is green! 🎉

@Amanieu Amanieu merged commit 8a6206b into Amanieu:master Nov 29, 2022
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.

None yet

3 participants