pkolaczk / fclones

Efficient Duplicate File Finder
MIT License
1.91k stars 71 forks source link

unable to compile on aarch64 musl #95

Closed ManOrs88 closed 2 years ago

ManOrs88 commented 2 years ago

hello, I'm unable to (cross)compile a musl binary on aarch64 ("cross" as in from ubuntu, still aarch64) [also tried compiling native on alpine aarch64, same result]

$ cargo install --target aarch64-unknown-linux-musl fclones
[cut]
   Compiling reflink v0.1.3
error[E0308]: mismatched types
  --> .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`
   |
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
warning: build failed, waiting for other jobs to finish...
error: failed to compile `fclones v0.17.1`

compiling with glibc works correctly

(rust 1.57.0)

regards, m

th1000s commented 2 years ago

The reflink master (already 2 years old) has a fix for that, try using that one instead of the one from crates.io by changing the reflink = "0.1.3" line in Cargo.toml to reflink = { git = "https://github.com/nicokoch/reflink.git", rev = "e8d93b465f5d9ad340cd052b64bbc77b8ee107e2" }

melissaboiko commented 2 years ago

Also happens with cargo build in Debian armhf/arm7vl (Raspberry Pi). Dunno if this is relevant but just putting it here for search engines.

Using the reflink (check out the repo, change Cargo.toml as above, do a cargo build --release ) works.

ethnh commented 2 years ago

The reflink master (already 2 years old) has a fix for that, try using that one instead of the one from crates.io by changing the reflink = "0.1.3" line in Cargo.toml to

Is there any reason fclones isn't using that version?

pkolaczk commented 2 years ago

It is not possible to publish a crate that relies on an unpublished crate. All dependencies must be in crates.io.

ethnh commented 2 years ago

RE: Piotr

Oh I see, that's just perfect 😆

th1000s commented 2 years ago

Through the magic of #[cfg(..)] reflink should not bother you any longer!

Unless you want to test fclones... I only left reflink active in the Linux build to test the macOS/Windows code paths, but these need not be build for the fclones binary itself.