kimono-koans/httm

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

ptrcnull opened this issue · 4 comments

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

  • httm version: 0.27.0
  • OS: Alpine Linux edge
  • Relevant filesystem/s: n/a

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`

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

0.27.2 builds properly now, thank you!