Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 2.36 KB

README.md

File metadata and controls

65 lines (50 loc) · 2.36 KB

gcc-musl-cross

Homebrew package manager formula to install cross-compiler toolchains targeting Linux boxes.

The default installation contains toolchains for x86 64-bit Linux (x86_64-linux-musl) and ARM 32/64-bit Linux (arm-linux-musleabihf/aarch64-linux-musl) as used on Raspberry Pi and similar devices. Others can be installed with package options (see brew info).

Note, when using the toolchain, the generated binaries will only run on a system with musl libc installed. Either musl-based distributions like Alpine Linux or distributions having musl libc installed as separate packages (e.g., Debian/Ubuntu).

Binaries statically linked with musl libc (linked with -static) have no external dependencies, even for features like DNS lookups or character set conversions that are implemented with dynamic loading on glibc. The application can be deployed as a single binary file and run on any device with the appropriate ISA and Linux kernel or Linux syscall ABI emulation layer including bare docker containers.

Tool Versions:

Based upon:

Usage

  1. Install with Homebrew:

    $ brew tap MarioSchwalbe/gcc-musl-cross
    $ brew install gcc-8-musl-cross
  2. For dynamically linked applications install the Debian/Ubuntu packages on the target device:

    $ sudo apt install musl:i386=1.1.19-1 musl:amd64=1.1.19-1

    Make sure to install the correct version. As of this writing Ubuntu 18.04 (Bionic) ships musl libc 1.1.19 also used to build the toolchain.

  3. Compile with <TARGET>-gcc e.g., x86_64-linux-musl-gcc, deploy, and run.

Supported Targets

  1. i686-linux-musl
  2. x86_64-linux-musl
  3. x86_64-linux-muslx32
  4. arm-linux-musleabi
  5. arm-linux-musleabihf
  6. aarch64-linux-musl
  7. mips-linux-musl
  8. mips64-linux-musl
  9. powerpc-linux-musl
  10. powerpc64-linux-musl

Other targets or variants can be added easily by extending the hash OPTION_TARGET_MAP in the formula as long as musl-cross-make and musl libc also support them.