mkcross is a super fast python toolkit to make linux and windows (mingw) toolchains in seconds
Program | Supported targets | Time to compile aarch64-linux-musl (including downloads) | program itself can run without being configured | Programmed in | Multi target in one command |
---|---|---|---|---|---|
mkcross | Musl/Linux, Mingw/Windows, Picolibc/Baremetal | 30s (90s) | ✅ | Python, C++ | ✅ |
musl-cross-make | Musl/Linux | 176s (197s) | ✅ | Shell, Makefile | ❌ |
crosstool-ng | uClibc/Linux GNU/Linux Newlib/Baremetal | N/A - no musl support | ❌ | Makefile | ❌ |
- Extremely fast.
- Portable sysroots - you can
mv
the sysroot anywhere you want and it will still work. - Supports Windows, Linux, Baremetal, and - experimentally - WasiX.
- Supports every architecture LLVM supports.
- No need to compile a whole compiler for your target
- Much faster to compile just compiler-rt, libc, libc++ than binutils, gcc and libc.
- No need to fiddle with binutils' and gcc's autoconf
- Sysroots can be used on any machine with clang and LLVM tools installed.
Simply run clang like this:
clang --config-system-dir=[Path to sysroot]/etc/mkcross/clang
Run cmake with -DCMAKE_TOOLCHAIN_FILE=[Path to sysroot]/etc/mkcross/toolchain.cmake
run mkcross --target=<triple>
- LLVM is a cross compiler by nature. If you feed it the correct libraries, it will happily output what you want. This program will download and/or compile the needed libraries. There is no need to download/compile a whole compiler.
- wasix support is currently highly experimental
- baremetal c++ is WIP and may not work on every architecture.
- WasiX support (EXPERIMENTAL)
- Windows target support
- MingW
- Proprietary (Visual Studio)
- FreeBSD
- Prebuilt (base.tar)
- From sources (src.tar)
- Mix (one of above + upstream LLVM)
- MacOS target support
- Some free software way
- Proprietary (XCode.xip)
- Linux
- musl
- uclibc
- glibc (cannot yet be built with clang)
- Bare metal (EXPERIMENTAL)
- Common libraries - zlib, curl, openssl
- More architectures in compiler RT
- Upstream to LLVM
- Parallel download and source extraction
- Parallel target generation
- Will require copying autoconf/symlinking source files.
- Query github api for source tarball size when download.
- Better config and yaml config for target
- Github actions to compile common targets
- Meson support (depends on this)
- mingw targets are not abi compatible with gcc mingw! They are however compatible with MSVC, including C++, thanks to the efforts of Google.
You need to link with more c++ libs: -lc++abi
and potentially -lunwind
You cant compile with LTO. I need to investigate this further. If you care about the details, see this blog post
Add -D_GNU_SOURCE to your defines.