Skip to content

FiloSottile/homebrew-musl-cross

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

homebrew-musl-cross

One-click static-friendly musl-based GCC macOS-to-Linux cross-compilers based on richfelker/musl-cross-make.

brew install filosottile/musl-cross/musl-cross

By default it will build a full cross compiler toolchain targeting musl Linux amd64.

You can then use x86_64-linux-musl- versions of the tools to build for the target. For example x86_64-linux-musl-cc will compile C code to run on musl Linux amd64.

The "musl" part of the target is important: the binaries will ONLY run on a musl-based system, like Alpine. However, if you build them as static binaries by passing -static as an LDFLAG they will run anywhere. Musl is specifically engineered to support static binaries.

Other architectures are supported. For example you can build a Raspberry Pi cross-compiler:

brew install FiloSottile/musl-cross/musl-cross --without-x86_64 --with-arm-hf

You can also use --with-i486 (x86 32-bit), --with-aarch64 (ARM 64-bit), --with-arm (ARM soft-float), --with-mips and --with-powerpc.

(Note: a custom build can take up to several hours and gigabytes of disk space, depending on the selected architectures and on the host CPU. The default installed size is between 200MB and 300MB.)

If you encounter issues with a missing musl-gcc binary, the build system might be assuming the presence of the musl host compiler wrapper. That should be reported as an issue, but you might be able to workaround it by creating a symlink:

ln -s /usr/local/opt/musl-cross/bin/x86_64-linux-musl-gcc /usr/local/bin/musl-gcc

About

Homebrew Formula for static-friendly musl-based GCC macOS-to-Linux cross-compilers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages