mussel
mussel is the shortest and fastest script available today to build working cross
compilers that target musl libc.
Features
- Up-to-date: uses latest available upstream sources for packages
- Fast: probably the fastest script around to build a cross compiler
targeting
musllibc, and runs fully underdash - Short: has the least amount of steps (see below) required to build a cross compiler targeting musl libc (even less than musl-cross-make)
- Small: all installation steps use
install-stripwhere applicable - Simple: easy to read, modify and extend
- POSIX Compliant: the entire script is POSIX compliant
- Well Documented: the script comes with a
DOCUMENTATION.mdfile that includes state of the art information explaining what is being done and why
Requirements:
To confirm you have all required packages, you can execute ./check.sh.
For Fedora:
sudo dnf install bash bc binutils bison bison-devel bzip2 ccache coreutils diffutils findutils gawk gcc gcc-c++ git glibc grep gzip libarchive lzip libzstd-devel m4 make perl rsync sed texinfo xz zstdUsage
Building a Cross Compiler
./mussel.sh (arch) (flags)(arch): See Supported Architectures below
(flags):
h | -h | --help Display help message
k | -k | --enable-pkg-config Enable optional pkg-config support
l | -l | --enable-linux-headers Enable optional Linux Headers support
o | -o | --enable-openmp Enable optional OpenMP support
p | -p | --parallel Use all available cores on the host system
x | -x | --disable-cxx Disable optional C++ supportOther Commands
./mussel.sh (command)(command):
c | -c | --clean Clean mussel's build environmentSources will be preserved.
Supported Architectures
- aarch64
- armv6zk (Raspberry Pi 1 Models A, B, B+, the Compute Module, and the Raspberry Pi Zero)
- armv7
- i586
- i686
- microblaze
- microblazeel
- mips64
- mips64el
- mipsisa64r6
- mipsisa64r6el
- or1k
- powerpc
- powerpc64
- powerpc64le
- riscv64
- s390x
- x86-64
Packages
binutils: 2.38gcc: 12.1.0gmp: 6.2.1isl: 0.24linux: 5.17.7 (Optional Linux Headers Support) (Disabled by default)mpc: 1.2.1mpfr: 4.1.0musl: 1.2.3pkgconf: 1.8.0 (Optionalpkg-configSupport) (Disabled by default)
How Is mussel Doing It?
- Install
muslheaders - Configure, build and install cross
binutils - Configure, build and install cross
gcc(withlibgcc-static) - Configure, build and install
musl - Build, and install
libgcc-shared
Optional Steps
- Build and install
libstdc++-v3(Optional C++ Support) (Enabled by default) - Build and install
libgomp(Optional OpenMP Support) (Disabled by default) - Install
linux-headers(Optional Linux Headers Support) (Disabled by default) - Configure, build and install
pkgconf(Optionalpkg-configSupport) (Disabled by default)
Using mussel With Host's pkg-config or pkgconf
The reason we included pkgconf with mussel as an optional step is
because we can easily configure the host's pkg-config or pkgconf to work
with mussel without having to build our own version of pkg-config or
pkgconf.
Here are the five magical environment variables that we need to set to configure
the host's pkg-config or pkgconf to work with mussel:
export PKG_CONFIG_PATH=$MSYSROOT/usr/lib/pkgconfig:$MSYSROOT/usr/share/pkgconfig
export PKG_CONFIG_LIBDIR=$MSYSROOT/usr/lib/pkgconfig:$MSYSROOT/usr/share/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=$MSYSROOT
export PKG_CONFIG_SYSTEM_INCLUDE_PATH=$MSYSROOT/usr/include
export PKG_CONFIG_SYSTEM_LIBRARY_PATH=$MSYSROOT/usr/libThe last two I believe are pkgconf specific but setting them won't do any harm.
Using mussel With Host's meson
mussel now provides cross-compilation configuration files for meson that
support all listed architectures, and a wrapper around host's meson
(mussel-meson) in an effort to make dealing with meson a bit easier.
Credits and Inspiration
mussel is possible thanks to the awesome work done by Aurelian, Rich Felker,
qword, The Managram Project, glaucus (where
it's actually implemented) and musl-cross-make.
Author
Firas Khalil Khana (firasuke) <firasuke@glaucuslinux.org>
Contributors
- Alexander Barris (AwlsomeAlex) <alex@awlsome.com>
- ayb <ayb@3hg.fr>
License
mussel is licensed under the Internet Systems Consortium (ISC) license.
Dedication
mussel is dedicated to all those that believe setting up a cross compiler
targeting musl libc is a complicated process.

