Linux command
musl-gcc 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compile program with musl libc
musl-gcc -o [program] [source.c]
Compile static binary
musl-gcc -static -o [program] [source.c]
Compile with optimization
musl-gcc -O2 -o [program] [source.c]
说明
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.
参数
- -o _file_
- Output file name.
- -static
- Create statically linked binary.
- -O _level_
- Optimization level.
- -specs _file_
- Use custom specs file.
FAQ
What is the musl-gcc command used for?
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.
How do I run a basic musl-gcc example?
Run `musl-gcc -o [program] [source.c]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _file_ do in musl-gcc?
Output file name.