Skip to content

error when compiling on macOS #10

@casouri

Description

@casouri

Is catfs supposted to run on macOS?

Errors below occured when I try to install it with cargo.

error[E0425]: cannot find function `fdopendir` in module `libc`
  --> src/catfs/rlibc.rs:56:29
   |
56 |     let dh = unsafe { libc::fdopendir(fd) };
   |                             ^^^^^^^^^ did you mean `opendir`?
help: possible candidate is found in another module, you can import it into scope
   |
6  | use catfs::rlibc::fdopendir;
   |

error[E0425]: cannot find function `pipe2` in module `libc`
   --> src/catfs/rlibc.rs:178:30
    |
178 |     let res = unsafe { libc::pipe2(p.as_mut_ptr(), libc::O_CLOEXEC) };
    |                              ^^^^^ did you mean `pipe`?

error[E0425]: cannot find function `splice` in module `libc`
   --> src/catfs/rlibc.rs:207:30
    |
207 |     let res = unsafe { libc::splice(fd, off_from_ptr, other, off_to_ptr, len, 0) };
    |                              ^^^^^^ not found in `libc`
help: possible candidate is found in another module, you can import it into scope
    |
6   | use catfs::rlibc::splice;
    |

error[E0425]: cannot find value `AT_EMPTY_PATH` in module `libc`
   --> src/catfs/rlibc.rs:279:66
    |
279 |     let res = unsafe { libc::fstatat(dir, s.as_ptr(), stp, libc::AT_EMPTY_PATH) };
    |                                                                  ^^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `utimensat` in module `libc`
   --> src/catfs/rlibc.rs:342:30
    |
342 |     let res = unsafe { libc::utimensat(dir, s.as_ptr(), times.as_mut_ptr(), flags as i32) };
    |                              ^^^^^^^^^ did you mean `utimes`?
help: possible candidate is found in another module, you can import it into scope
    |
6   | use catfs::rlibc::utimensat;
    |

error[E0425]: cannot find function `posix_fallocate` in module `libc`
   --> src/catfs/rlibc.rs:435:34
    |
435 |         let res = unsafe { libc::posix_fallocate(self.fd, offset as i64, len as i64) };
    |                                  ^^^^^^^^^^^^^^^ not found in `libc`

error[E0308]: mismatched types
   --> src/catfs/mod.rs:195:21
    |
195 |                     st.f_blocks,
    |                     ^^^^^^^^^^^ expected u64, found u32
help: you can cast an `u32` to `u64`, which will zero-extend the source value
    |
195 |                     st.f_blocks.into(),
    |                     ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/catfs/mod.rs:196:21
    |
196 |                     st.f_bfree,
    |                     ^^^^^^^^^^ expected u64, found u32
help: you can cast an `u32` to `u64`, which will zero-extend the source value
    |
196 |                     st.f_bfree.into(),
    |                     ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/catfs/mod.rs:197:21
    |
197 |                     st.f_bavail,
    |                     ^^^^^^^^^^^ expected u64, found u32
help: you can cast an `u32` to `u64`, which will zero-extend the source value
    |
197 |                     st.f_bavail.into(),
    |                     ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/catfs/mod.rs:198:21
    |
198 |                     st.f_files,
    |                     ^^^^^^^^^^ expected u64, found u32
help: you can cast an `u32` to `u64`, which will zero-extend the source value
    |
198 |                     st.f_files.into(),
    |                     ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/catfs/mod.rs:199:21
    |
199 |                     st.f_ffree,
    |                     ^^^^^^^^^^ expected u64, found u32
help: you can cast an `u32` to `u64`, which will zero-extend the source value
    |
199 |                     st.f_ffree.into(),
    |                     ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/catfs/file.rs:598:56
    |
598 |         self.src_file = File::openat(dir, path, flags, mode)?;
    |                                                        ^^^^ expected u32, found u16
help: you can cast an `u16` to `u32`, which will zero-extend the source value
    |
598 |         self.src_file = File::openat(dir, path, flags, mode.into())?;
    |                                                        ^^^^^^^^^^^

error[E0560]: struct `catfs::libc::dirent` has no field named `d_off`
  --> src/catfs/rlibc.rs:89:17
   |
89 |                 d_off: 0,
   |                 ^^^^^^ `catfs::libc::dirent` does not have this field
   |
   = note: available fields are: `d_ino`, `d_seekoff`, `d_reclen`, `d_namlen`, `d_type`, `d_name`

error[E0308]: mismatched types
  --> src/catfs/rlibc.rs:92:25
   |
92 |                 d_name: [0i8; 256], // FIXME: don't hardcode 256
   |                         ^^^^^^^^^^ expected an array with a fixed size of 1024 elements, found one with 256 elements
   |
   = note: expected type `[i8; 1024]`
              found type `[i8; 256]`

error[E0609]: no field `d_off` on type `catfs::libc::dirent`
   --> src/catfs/rlibc.rs:120:24
    |
120 |         return self.en.d_off;
    |                        ^^^^^ unknown field
    |
    = note: available fields are: `d_ino`, `d_seekoff`, `d_reclen`, `d_namlen`, `d_type`, `d_name`

error[E0308]: mismatched types
   --> src/catfs/rlibc.rs:158:48
    |
158 |     let res = unsafe { libc::mkdir(s.as_ptr(), mode) };
    |                                                ^^^^ expected u16, found u32

error[E0308]: mismatched types
   --> src/catfs/rlibc.rs:168:55
    |
168 |     let res = unsafe { libc::mkdirat(dir, s.as_ptr(), mode) };
    |                                                       ^^^^ expected u16, found u32

error[E0308]: mismatched types
   --> src/catfs/rlibc.rs:352:56
    |
352 |     let res = unsafe { libc::fchmodat(dir, s.as_ptr(), mode, flags as i32) };
    |                                                        ^^^^ expected u16, found u32

error[E0308]: mismatched types
   --> src/catfs/rlibc.rs:459:50
    |
459 |         let res = unsafe { libc::fchmod(self.fd, mode) };
    |                                                  ^^^^ expected u16, found u32

error[E0308]: mismatched types
  --> src/catfs/inode.rs:39:15
   |
39 |     match t & libc::S_IFMT {
   |               ^^^^^^^^^^^^ expected u32, found u16

error[E0308]: mismatched types
  --> src/catfs/inode.rs:40:9
   |
40 |         libc::S_IFLNK => fuse::FileType::Symlink,
   |         ^^^^^^^^^^^^^ expected u32, found u16
   |
   = note: expected type `u32`
              found type `u16`

error[E0308]: mismatched types
  --> src/catfs/inode.rs:41:9
   |
41 |         libc::S_IFREG => fuse::FileType::RegularFile,
   |         ^^^^^^^^^^^^^ expected u32, found u16
   |
   = note: expected type `u32`
              found type `u16`

error[E0308]: mismatched types
  --> src/catfs/inode.rs:42:9
   |
42 |         libc::S_IFBLK => fuse::FileType::BlockDevice,
   |         ^^^^^^^^^^^^^ expected u32, found u16
   |
   = note: expected type `u32`
              found type `u16`

error[E0308]: mismatched types
  --> src/catfs/inode.rs:43:9
   |
43 |         libc::S_IFDIR => fuse::FileType::Directory,
   |         ^^^^^^^^^^^^^ expected u32, found u16
   |
   = note: expected type `u32`
              found type `u16`

error[E0308]: mismatched types
  --> src/catfs/inode.rs:44:9
   |
44 |         libc::S_IFCHR => fuse::FileType::CharDevice,
   |         ^^^^^^^^^^^^^ expected u32, found u16
   |
   = note: expected type `u32`
              found type `u16`

error[E0308]: mismatched types
  --> src/catfs/inode.rs:45:9
   |
45 |         libc::S_IFIFO => fuse::FileType::NamedPipe,
   |         ^^^^^^^^^^^^^ expected u32, found u16
   |
   = note: expected type `u32`
              found type `u16`

error[E0277]: no implementation for `u32 & u16`
  --> src/catfs/inode.rs:39:13
   |
39 |     match t & libc::S_IFMT {
   |             ^ no implementation for `u32 & u16`
   |
   = help: the trait `std::ops::BitAnd<u16>` is not implemented for `u32`

error[E0308]: mismatched types
   --> src/catfs/inode.rs:131:31
    |
131 |             kind: to_filetype(st.st_mode),
    |                               ^^^^^^^^^^ expected u32, found u16
help: you can cast an `u16` to `u32`, which will zero-extend the source value
    |
131 |             kind: to_filetype(st.st_mode.into()),
    |                               ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/evicter/mod.rs:104:50
    |
104 |         DiskSpace::Percent(p) => ((st.f_blocks * st.f_frsize) as f64 * p / 100.0) as u64,
    |                                                  ^^^^^^^^^^^ expected u32, found u64

error[E0277]: cannot multiply `u64` to `u32`
   --> src/evicter/mod.rs:104:48
    |
104 |         DiskSpace::Percent(p) => ((st.f_blocks * st.f_frsize) as f64 * p / 100.0) as u64,
    |                                                ^ no implementation for `u32 * u64`
    |
    = help: the trait `std::ops::Mul<u64>` is not implemented for `u32`

error[E0308]: mismatched types
   --> src/evicter/mod.rs:108:37
    |
108 |     let x = desired - (st.f_bfree * st.f_frsize) as i64;
    |                                     ^^^^^^^^^^^ expected u32, found u64

error[E0277]: cannot multiply `u64` to `u32`
   --> src/evicter/mod.rs:108:35
    |
108 |     let x = desired - (st.f_bfree * st.f_frsize) as i64;
    |                                   ^ no implementation for `u32 * u64`
    |
    = help: the trait `std::ops::Mul<u64>` is not implemented for `u32`

error: aborting due to 32 previous errors

error: failed to compile `catfs v0.8.0`, intermediate artifacts can be found at `/var/folders/8j/gcq2wfcj41jbn45x071shl4h0000gn/T/cargo-install.75RhyeDLPNLv`

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions