flo-at / minmon

MinMon - an opinionated minimal monitoring and alarming tool
Apache License 2.0
330 stars 14 forks source link

Release with binary #208

Open urza opened 2 weeks ago

urza commented 2 weeks ago

Hi, would you consider publishing compiled binary with your releases please?

For people who are not rust developers, it is added complexity to compile minmon. I just followed your instructions, but my cargo install command ended with error

error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: could not compile `proc-macro2` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `libc` (build script) due to 1 previous error
error: failed to compile `minmon v0.9.0 (/home/urza/minmon/minmon)`, intermediate artifacts can be found at `/home/urza/minmon/minmon/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

I can imagine that it is not just me who would appreciate if you published the binary with releases that we could just drop into the system..

Thanks

flo-at commented 2 weeks ago

This error looks like there are build tools missing. If you're using Ubuntu or something similar please try this:

sudo apt update
sudo apt install build-essential

The docker image is a portable binary release, you might consider using that instead. Releasing "plain" binaries is not as simple as it might seem. Some of the dependencies are linked to shared objects outside of minmon itself, so the resulting binary is not 100% portable. It would be an option to offer pre-built Debin/Ubuntu and/or RPM packages though. Which distribution are you using?

urza commented 2 weeks ago

I am using Ubuntu Server. Mix of 22.04 and 24.04

Docker is nice, but I would also like to use minmon in some situations which are so low on resources that running Docker is not possible (VPS and such).

Doesn't rust have something like static build where it compiles all it needs into the resulting binary?

flo-at commented 1 week ago

Doesn't rust have something like static build where it compiles all it needs into the resulting binary?

Yes and no. The rust "parts" of the binary are statically linked. But some of the dependencies dynamically link to shared objects. This is the output of ldd for the MinMon binary on Arch Linux:

    linux-vdso.so.1 (0x00007ffe7efc4000)
    libssl.so.3 => /usr/lib/libssl.so.3 (0x000076b1bd927000)
    libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x000076b1bd400000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x000076b1bdcb1000)
    libm.so.6 => /usr/lib/libm.so.6 (0x000076b1bd315000)
    libc.so.6 => /usr/lib/libc.so.6 (0x000076b1bd131000)
    /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x000076b1bdce3000)

OpenSSL (libcrypto and libssl) could be replaced with rustls which minmon already supports. The resulting binary would have improved portability but still not perfect (i.e. musl-based distributions like Alpine still won't work). Prepackaged deb and rpm packages would be more robust as they track dependencies and give proper error messages when they fail to install. I'm undecided on which way is the better one to be honest. Do you know other projects that release prebuilt (unpackaged) binaries? Would be good to see how others handle this problem.

Did you try to build with build-essentials installed on Ubuntu?