BurntSushi/ripgrep

Provide Statically Compiled Binaries for (aarch64|arm64) Linux

Azathothas opened this issue · 4 comments

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/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep-14.1.0-aarch64-unknown-linux-gnu.tar.gz
$ file rg && ldd rg
rg: 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]=62e25ad353379dfb4ddf3c94be5e00cd086d56d5, stripped
        linux-vdso.so.1 (0x0000ffffa91df000)
        libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffa8c40000)
        libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffffa8c20000)
        libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffffa8c00000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffa8a50000)
        /lib/ld-linux-aarch64.so.1 (0x0000ffffa91a6000)
$ du -sh rg
5.2M    rg

Adding target: aarch64-unknown-linux-musl in https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.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/ripgrep.sh

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

I'd be okay with adding this target in a way that matches the configuration of everything else. (The question of whether to enable LTO or not has been discussed a few times before. I remain reluctant to enable it for releases.)