Trying Out MUSL
MUSL is a C standart library installation. It is an alternative to prominent glibc implementation. I have taken glibc for granted…
Trying Out MUSL
MUSL is a C standart library installation. It is an alternative to prominent glibc implementation. I have taken glibc for granted throughout my programming journey until Alpine Linux has brought it my attention.
MUSL can be installed via following simple installation steps.
git clone git://git.musl-libc.org/musl
cd musl
./configure
make
MUSL-GCC is under
/usr/local/musl/bin
Add this folder to your path. We can now use musl-gcc to compile our C projects with MUSL C implementation.
How Does It Fare?
I tried the library on several simple source files and compared the sizes of generated binaries.
File 1: Simple Dynamic Loading
[embed]
gcc -ldl example_rtld.c -o glibc_output
musl-gcc example_rtld.c -o musl_output

File 2: Linux File Locking
[embed]
gcc flock_test.c -o glibc_output
musl-gcc flock_test.c -o musl_output

File 3: A Pretty Ancient Grep Implementation
This link contains a fairly old grep implementation. Let’s see how well each of them do.
gcc grep.c -o glibc_output
musl-gcc grep.c -o musl_output

Do We Really Link to MUSL?
Let us check out ELF headers
readelf --header musl_output | grep INTERP -A 2

Use ld list to list dependencies

Thanks for reading.
메타데이터
- post_id
- b9696eef2897
- slug
- trying-out-musl-b9696eef2897
- url
- https://medium.com/@sddkal/trying-out-musl-b9696eef2897
- canonical_url
- https://medium.com/@sddkal/trying-out-musl-b9696eef2897
- author_url
- https://medium.com/@sddkal
- status
- ok
- fetched_at
- 2026-07-29 08:30:22