kimono-koans / httm

Interactive, file-level Time Machine-like tool for ZFS/btrfs/nilfs2 (and even Time Machine and Restic backups!)
https://crates.io/crates/httm
Mozilla Public License 2.0
1.31k stars 28 forks source link

Doesn't build on musl - libc::malloc_trim is GNU-specific #78

Closed ptrcnull closed 1 year ago

ptrcnull commented 1 year ago

Describe the bug When building httm with musl libc, for example on Alpine Linux, the build fails with the following:

error[E0425]: cannot find function `malloc_trim` in crate `libc`                             
   --> src/exec/interactive.rs:104:27
    |
104 |             let _ = libc::malloc_trim(0);
    |                           ^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `malloc_trim` in crate `libc`
   --> src/exec/interactive.rs:172:35
    |
172 |                     let _ = libc::malloc_trim(0);
    |                                   ^^^^^^^^^^^ not found in `libc`

To Reproduce

$ docker run --rm -it alpine:edge sh -c 'apk add cargo && cargo install httm@0.27.0'

Expected behavior A additional target_env = "gnu" guard before libc::malloc_trim, both in httm itself and in the two_percent crate.

Additional context

kimono-koans commented 1 year ago

Should fix: https://github.com/kimono-koans/httm/releases/tag/0.27.1

ptrcnull commented 1 year ago

As I mentioned, malloc_trim is also used in the two_percent crate; the command I posted to reproduce the issue still fails (after changing the source to git HEAD instead of crates.io: cargo install --git https://github.com/kimono-koans/httm)

error[E0425]: cannot find function `malloc_trim` in crate `libc`
   --> cargo/registry/src/github.com-1ecc6299db9ec823/two_percent-0.10.18/src/lib.rs:341:27
    |
341 |             let _ = libc::malloc_trim(0);
    |                           ^^^^^^^^^^^ not found in `libc`
kimono-koans commented 1 year ago

As I mentioned, malloc_trim is also used in the two_percent crate

Ooops, my mistake, will you check to see if the following fixes?: https://github.com/kimono-koans/httm/releases/tag/0.27.2

ptrcnull commented 1 year ago

0.27.2 builds properly now, thank you!