eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
12.4k stars 219 forks source link

feat: Provide Statically Compiled Binaries for (aarch64|arm64) Linux #850

Open Azathothas opened 9 months ago

Azathothas commented 9 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/eza-community/eza/releases/download/v0.18.3/eza_aarch64-unknown-linux-gnu.tar.gz

$ file eza && ldd eza
eza: 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]=4294a9d061bb5befd198404ad84c3441082c3225, stripped
        linux-vdso.so.1 (0x0000ffffa4871000)
        libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffa4670000)
        libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffffa4650000)
        libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffffa45b0000)
        libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffffa4590000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffa43e0000)
        /lib/ld-linux-aarch64.so.1 (0x0000ffffa4838000)

Adding target: aarch64-unknown-linux-musl in your releaser should work. However, you can release an even more optimized binary, based on : https://github.com/Azathothas/Toolpacks/blob/main/.github/scripts/aarch64_Linux/bins/eza.sh

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

Been trying to decipher this but I might be in over my head. As I understand statically linked builds were added in https://github.com/eza-community/eza/commit/30ab689fbe143efa3328c4dbd897c975bbed1ef6 and the lines that kick them off in the justfile have since been commented out.

example of them being turned off:

So I'm not sure how to continue (and how to test those as I only own 1 machine)

edit: installed the cross tool and docker. I'm having fun with this but my confidence-level in creating a PR that resolves this issue plummeted

cafkafk commented 3 weeks ago

For what it's worth, if I remember correctly, yea, we basically just used to have this, but it broke and we never figured out why, so it was removed.

One option to debug this may be to bisect from the last time it worked until it broke, that may find the actual cause.