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.36k stars 29 forks source link

I'm trying to build and run on Buster and getting the following #61

Closed kimono-koans closed 1 year ago

kimono-koans commented 1 year ago
    Did you ever get this sorted?  I'm trying to build and run on Buster and getting the following:
 Compiling httm v0.18.2 (/usr/local/cargo/git/checkouts/httm-06074a082ad4c88e/0375596)
error[E0308]: mismatched types
   --> src/library/utility.rs:68:33
    |
68  |         ret = libc::setpriority(priority_type as u32, tid, priority_level)
    |               ----------------- ^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
    |               |
    |               arguments to this function are incorrect
    |
note: function defined here
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.138/src/unix/linux_like/linux/musl/mod.rs:733:12
    |
733 |     pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
    |            ^^^^^^^^^^^
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
    |
68  |         ret = libc::setpriority((priority_type as u32).try_into().unwrap(), tid, priority_level)
    |                                 +                    +++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `httm` due to previous error
error: failed to compile `httm v0.18.2 (https://github.com/kimono-koans/httm.git?tag=0.18.2#03755960)`, intermediate artifacts can be found at `/tmp/cargo-installKsWLW7`
The command '/bin/sh -c cargo install --git https://github.com/kimono-koans/httm.git --tag "0.18.2" --target x86_64-unknown-linux-musl' returned a non-zero code: 101

Originally posted by @PrplHaz4 in https://github.com/kimono-koans/httm/issues/17#issuecomment-1355513447

kimono-koans commented 1 year ago

The issue you seem to be having is musl uses a different value than glibc for its setpriority function (which you have ask "Why?").

FIX/MITIGATION: httm's pub fn nice_thread and pub enum PriorityType in mod crate::library::utility are actually dead code in the latest version, so you can just remove/comment out both, if you want.

Policy wise, this is a WONTFIX issue (because old compilers, old/different libcs, etc., I won't support), but I may just excise pub fn nice_thread, et. al., or comment out to avoid in the future.

Good luck getting it to build! Happy to try to help, but, as indicated, this config is unsupported and I reserve the right to say "Oops, sorry can't help."

PrplHaz4 commented 1 year ago

The issue you seem to be having is musl uses a different value than glibc for its setpriority function (which you have ask "Why?").

FIX/MITIGATION: httm's pub fn nice_thread and pub enum PriorityType in mod crate::library::utility are actually dead code in the latest version, so you can just remove/comment out both, if you want.

Policy wise, this is a WONTFIX issue (because old compilers, old/different libcs, etc., I won't support), but I may just excise pub fn nice_thread, et. al., or comment out to avoid in the future.

Good luck getting it to build! Happy to try to help, but, as indicated, this config is unsupported and I reserve the right to say "Oops, sorry can't help."

Thanks for the explanation and guidance! Fully understand not wanting to support a million build variants.

I commented both nice_thread and PriorityType, built it inside a rust:slim-buster container, then copied them to my host and all seems to be working fine.

The image is available on docker hub as prplhaz4/httm:v0.18.2-buster for anyone looking...

Dockerfile

FROM rust:1-slim-buster as builder
#WORKDIR /usr/src/myapp
COPY ./httm-0.18.2 .
RUN apt update && apt upgrade -y
RUN rustup target add x86_64-unknown-linux-musl
RUN rustup toolchain install stable-x86_64-unknown-linux-musl
#RUN cargo install --git https://github.com/kimono-koans/httm.git --tag "0.18.2" --target x86_64-unknown-linux-musl
RUN cargo install --path . --target x86_64-unknown-linux-musl

FROM debian:buster-slim
RUN apt-get update && apt-get install -y nano && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/httm /usr/local/bin/httm
CMD ["httm"]

#> docker cp httm:/usr/local/bin/httm ./httm