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 errors for i686-apple-darwin #991

Closed
MarcusCalhoun-Lopez opened this issue Jan 15, 2024 · 1 comment · Fixed by #1000
Closed

Build errors for i686-apple-darwin #991

MarcusCalhoun-Lopez opened this issue Jan 15, 2024 · 1 comment · Fixed by #1000

Comments

@MarcusCalhoun-Lopez
Copy link

I am trying to compile rustix on 32-bit macOS systems.
This means that fix_y2038 is set to true, unlike on 64-bit systems.
The first error is in src/backend/libc/fs/syscalls.rs, where the system attempts a Linux fix.
A possible fix is below.

--- a/src/backend/libc/fs/syscalls.rs
+++ b/src/backend/libc/fs/syscalls.rs
@@ -803,7 +803,7 @@ pub(crate) fn utimensat(
 ) -> io::Result<()> {
     // Old 32-bit version: libc has `utimensat` but it is not y2038 safe by
     // default. But there may be a `__utimensat16` we can use.
-    #[cfg(fix_y2038)]
+    #[cfg(all(fix_y2038, not(apple)))]
     {
         #[cfg(target_env = "gnu")]
         if let Some(libc_utimensat) = __utimensat64.get() {
@@ -1505,7 +1505,7 @@ fn libc_statvfs_to_statvfs(from: c::statvfs) -> StatVfs {
 pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> {
     // Old 32-bit version: libc has `futimens` but it is not y2038 safe by
     // default. But there may be a `__futimens64` we can use.
-    #[cfg(fix_y2038)]
+    #[cfg(all(fix_y2038, not(apple)))]
     {
         #[cfg(target_env = "gnu")]
         if let Some(libc_futimens) = __futimens64.get() {

With that patch, the following four lines of code cause errors because of type incapabilities.
Timespec and c::timespec are not type aliases of one another when fix_y2038 is true.
I am afraid I am not very proficient in Rust yet.
I would be happy to try to put together a pull request with a little guidance.

times.last_access = now;
times.last_modification = now;
return_times[times_index] = times.last_modification;
return_times[times_index] = times.last_access;
sunfishcode added a commit that referenced this issue Jan 18, 2024
On i686-apple-darwin, `time_t` is 32-bit, so it needs `fix_y2038` and
conversions for `Timespec` values.

Fixes #991.
sunfishcode added a commit that referenced this issue Jan 23, 2024
On i686-apple-darwin, `time_t` is 32-bit, so it needs `fix_y2038` and
conversions for `Timespec` values.

Fixes #991.
@sunfishcode
Copy link
Member

This is now released in rustix 0.38.31.

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 a pull request may close this issue.

2 participants