Skip to content

Add a statically-linked musl file to releases#19

Merged
m1guelpf merged 1 commit intom1guelpf:mainfrom
juan-leon:main
Jan 20, 2023
Merged

Add a statically-linked musl file to releases#19
m1guelpf merged 1 commit intom1guelpf:mainfrom
juan-leon:main

Conversation

@juan-leon
Copy link
Contributor

Having a statically linked binary is useful for being able to use tool in systems with old glibc versions.

Useful for being able to use tool in systems with old glibc versions
@m1guelpf
Copy link
Owner

@juan-leon Could you elaborate a bit more on why this is useful?

@juan-leon
Copy link
Contributor Author

juan-leon commented Jan 20, 2023

The current releases have a binary dinamically linked. That is: binary reuses libraries supposedly present in the system and cannot be used in those systems without those libraries.

Github actions run in a modern Ubuntu (runs-on: ubuntu-latest, as per your workflow file). So linker assumes a modern version of those libraries present in the systems where tool will execute.

Unfortunately this is not always the case (for instance, in older versions of Ubuntu like I use).

This is the output of ldd on my system for the plz I downloaded fro your releases page

$ ldd plz
./plz: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./plz)
./plz: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./plz)
./plz: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./plz)
./plz: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.29' not found (required by ./plz)
./plz: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by ./plz)
./plz: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./plz)
        linux-vdso.so.1 (0x00007ffe2774b000)
        libgtk3-nocsd.so.0 => /usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007f04f6ad2000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f04f68ba000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f04f651c000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f04f612b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f04f73b9000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f04f5f27000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f04f5d08000)

(and of course the binary does not work)

This is the output of ldd with the musl binary I generated with my fork of your project:

$ ldd /home/juanleon/bin/plz
        statically linked

File is somewhat bigger (14M vs 13M), but it can run in every linux system with arch amd64/i686.

Often widely used tools built with rust politely include a musl version in the releases page (in addition to the dynamically linked version) for those that have old (or not so mainstream) linux systems. Examples:

Hope it helps. Please let me know if you need more info.

GitHub
A cat(1) clone with wings. Contribute to sharkdp/bat development by creating an account on GitHub.
GitHub
ripgrep recursively searches directories for a regex pattern while respecting your gitignore - BurntSushi/ripgrep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants