Skip to content

Build errors for i686-apple-darwin #991

@MarcusCalhoun-Lopez

Description

@MarcusCalhoun-Lopez

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions