sharkdp / hexyl

A command-line hex viewer
Apache License 2.0
8.92k stars 227 forks source link

Provide Statically Compiled Binaries for (aarch64|arm64) Linux #217

Open Azathothas opened 4 months ago

Azathothas commented 4 months ago

Hi, the current releases for arm64 Linux is based on gnu and not musl. As a result, the binary is dynamically linked:

$ https://github.com/sharkdp/hexyl/releases/download/v0.14.0/hexyl-v0.14.0-aarch64-unknown-linux-gnu.tar.gz

$ file hexyl && ldd hexyl
hexyl: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=ae7ee4105a895435fc22524bd4291da60449ca0c, with debug_info, not stripped
        linux-vdso.so.1 (0x0000ffffa4ffc000)
        libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffa4ec0000)
        libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffffa4ea0000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffa4cf0000)
        /lib/ld-linux-aarch64.so.1 (0x0000ffffa4fc3000)

$ du -sh hexyl
2.9M    hexyl

Adding target: aarch64-unknown-linux-musl in https://github.com/sharkdp/hexyl/blob/master/.github/workflows/CICD.yml should work.

However, you can release an even more optimized & smaller binary , based on : https://github.com/Azathothas/Toolpacks/blob/main/.github/scripts/aarch64_Linux/bins/hexyl.sh

$ file "./target/$RUST_TARGET/release/hexyl"
./target/aarch64-unknown-linux-musl/release/hexyl: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped

$ du -sh "./target/$RUST_TARGET/release/hexyl"
800K    ./target/aarch64-unknown-linux-musl/release/hexyl
sharkdp commented 1 week ago

I'd rather not pull in external dependencies / scripts just for building binaries. But if someone wants to add that target in CICD.yml, please go ahead.