LinuxCommandLibrary

musl-gcc

GCC wrapper that compiles programs against musl libc instead of glibc

TLDR

Compile program with musl libc

$ musl-gcc -o [program] [source.c]
copy
Compile static binary
$ musl-gcc -static -o [program] [source.c]
copy
Compile with optimization
$ musl-gcc -O2 -o [program] [source.c]
copy

SYNOPSIS

musl-gcc [options] sourcefiles_...

DESCRIPTION

musl-gcc is a GCC wrapper that compiles programs against musl libc instead of glibc. Musl is a lightweight C standard library designed for static linking and embedded systems. Creates smaller, portable binaries suitable for containers and minimal environments.

PARAMETERS

-o file

Output file name.
-static
Create statically linked binary.
-O level
Optimization level.
-specs file
Use custom specs file.

SEE ALSO

gcc(1), clang(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community