reflink icon indicating copy to clipboard operation
reflink copied to clipboard

Incompatible with musl

Open pcarrier opened this issue 1 year ago • 2 comments

error[E0308]: mismatched types
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/reflink-0.1.3/src/sys/unix.rs:21:39
    |
21  |         libc::ioctl(dest.as_raw_fd(), IOCTL_FICLONE, src.as_raw_fd())
    |         -----------                   ^^^^^^^^^^^^^ expected `i32`, found `u64`
    |         |
    |         arguments to this function are incorrect
    |
note: function defined here
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/linux_like/linux/musl/mod.rs:739:12
    |
739 |     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
    |            ^^^^^
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
    |
21  |         libc::ioctl(dest.as_raw_fd(), IOCTL_FICLONE.try_into().unwrap(), src.as_raw_fd())
    |                                                    ++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `reflink` due to previous error

pcarrier avatar May 16 '23 22:05 pcarrier

Can be tested on Debian-based systems with:

$ sudo apt-get install musl-tools
$ rustup toolchain install --force-non-host stable-x86_64-unknown-linux-musl
$ rustup target add x86_64-unknown-linux-musl
$ cargo build --release --target x86_64-unknown-linux-musl

pcarrier avatar May 16 '23 22:05 pcarrier

This already has a fix (#5), but it hasn't been included in a released crate. Can you try with a specified git revision, like https://github.com/bczhc/rust/commit/e9df2babbabf20588c891f55af113d46293441ea?

bczhc avatar Jun 10 '23 04:06 bczhc