• Stars
    star
    209
  • Rank 188,325 (Top 4 %)
  • Language
    Shell
  • Created over 12 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A small suite of scripts and patches for building musl libc cross compilers.

About musl-cross

This is a small suite of scripts and patches to build a musl libc cross-compiler. Prebuilt cross and native compilers are available at http://musl.codu.org/

For the impatient, ./build.sh should build a cross compiler to /opt/cross/<arch>-linux-musl, no muss, no fuss. Otherwise, you can edit config.sh to make cross-compilers to other architectures, and even copy config.sh to another directory then run build.sh from there to avoid polluting the source dir.

Project Scope

Supported are GCC 4.0.3 until 5.3.0. for newer GCCs check out the musl-cross-make project.

Notes on building normal cross compilers

  • For ARM, you must set the triple to arm-linux-musleabi (eabi is the important bit here)

  • You can set versions of binutils, GCC or musl in config.sh with:

      BINUTILS_VERSION=<version>
      GCC_VERSION=<version>
      MUSL_VERSION=<version>
    
  • You can set configure flags for each step:

      BINUTILS_CONFFLAGS=...
      GCC_BOOTSTRAP_CONFFLAGS=...
      MUSL_CONFFLAGS=...
      GCC_CONFFLAGS=...
    
  • You can use a git checkout of musl with:

      MUSL_VERSION=<git tag or commit>
      MUSL_GIT=yes
    
  • If you do not have the GMP, MPFR and/or MPC development libraries on your host, you can build them along with GCC with a config.sh line:

      GCC_BUILTIN_PREREQS=yes
    

Recommendations

  • If you would like to target a specific CPU revision, usually this is done by GCC configuration options like so:

      GCC_BOOTSTRAP_CONFFLAGS="--with-cpu=armv4t"
      GCC_CONFFLAGS="--with-cpu=armv4t"
    

    For ix86 however, it is more common to do this by the target name, e.g. i486-linux-musl instead of i686-linux-musl.

Upgrading cross compilers

It is possible to upgrade the musl version in a musl-cross cross compiler without rebuilding the entire cross compiler prefix from scratch. Simply download and extract the new version of musl, then configure it like so:

./configure --prefix="<prefix>/<triple>" CC="<triple>-gcc"

Where <prefix> is the prefix the cross compiler root was installed/extracted to, and <triple> is the GNU-style target triple (e.g. i486-linux-musl).

Other scripts and helpers

  • config.sh is an example configuration file. In many cases, it will do exactly what you want it to do with no modification, which is why it's simply named config.sh instead of, e.g., config-sample.sh

  • extra/build-gcc-deps.sh will build the dependencies for GCC into the build prefix specified by config.sh, which are just often a nice thing to have. It is of course not necessary.

  • extra/build-tarballs.sh builds convenient musl cross-compiler tarballs in a rather inconvenient way. It first builds a musl cross-compiler to the host platform (e.g. i686), then it uses that to build static cross-compilers to various platforms. As a result, building e.g. three cross-compiler tarballs involves eight compiler build phases (read: this is slow). However, the resultant tarballs are cross-compilers statically linked against musl, making them stable and portable.

  • config-static.sh is an example configuration file for building a static cross-compiler. You can use this if, e.g., you already have a build of musl (and so have musl-gcc) but would like to make a complete, static cross-compiler based on that, or if you already have a musl cross-compiler (and so have <arch>-linux-musl-gcc) but would like to make a static cross-compiler itself compiled against musl.

Requirements

musl-cross depends on:

  • shell and coreutils (busybox is fine)
  • mercurial or git (for checkout only)
  • wget (busybox is fine)
  • patch
  • gcc
  • make
  • awk (busybox is fine)

The following are GCC dependencies, which can be installed on the host system, or installed automatically using GCC_BUILTIN_PREREQS=yes:

  • gmp
  • mpfr
  • mpc

Building GMP additionally requires m4.

Compiler/Arch Compatibility Matrix

i?86 x86_64 x32 mips powerpc arm7 armhf mb sh4 or1k
4.4.7 yes yes yes yes yes
4.5.4 yes yes yes yes yes
4.6.4 yes yes yes yes yes
4.7.4 yes yes yes yes yes yes yes
4.8.5 yes yes yes yes yes yes yes yes yes
4.9.3 yes yes yes yes yes yes yes yes yes
5.3.0 yes yes yes yes yes yes yes yes yes *

* or1k requires integration of a patch (issue #61)

More Repositories

1

rnnoise-models

Trained neural networks and requisite information and data for rnnoise-nu
C
261
star
2

snowflake

Snowflake is a highly experimental Linux distribution based on the musl C library, with a per-process view of the /usr filesystem, such that users may choose to have different perceptions of which packages are available on the system.
C
35
star
3

gelfload

gelfload is Gregor's ELF loader. It is a usermode loader for ELF executables, used for two purposes: 1) Creating ELF environments on otherwise ELF-hostile platforms (e.g. Mac OS X and Windows) 2) Cross-loading ELF binaries intended for different platforms.
C
34
star
4

musl-gcc-patches

Patches to GCC necessary for supporting musl.
22
star
5

mlibtool

The libtool accelerator: A miniature frontend for libtool that replaces libtool on sensible systems, and simply calls GNU libtool on everything else.
C
18
star
6

musl-pkgsrc-patches

A collection of patches to NetBSD pkgsrc for musl libc.
Diff
15
star
7

autoconf-lean

A small collection of macros for autoconf/automake to make fast configure scripts, by eschewing compatibility with ridiculously obsolescent systems and avoiding tests that have no effect when successful and terminate configuration when unsuccessful.
C
11
star
8

plip

A batch and linear video editor and video task automator
JavaScript
9
star
9

ggggc

GGGGC is Gregor's General-purpose Generational Garbage Collector. It is a portable, precise, C-library garbage collector intended to be used for VMs.
C
9
star
10

lstg

Little Smalltalk-G: A modern fork of Little Smalltalk for teaching
C
7
star
11

rain-retro-modern

XFWM4 (XFCE) theme based on the copland theme with a somewhat modernized Classic Mac look
Makefile
7
star
12

midifile

A MIDI file library intended to work well with PortMIDI ( http://portmedia.sourceforge.net/ ).
C
3
star
13

sdyn

A simple implementation of a dynamic language intended for an educational setting.
C
3
star
14

umlbox

UML-based strong sandboxing solution.
C
3
star
15

smalljitasm

An in-memory assembler intended to be used by simple, educational JITs.
C
2
star
16

eyc

Eat Your Controller
TypeScript
2
star
17

picocjs-old

C interpreter for JavaScript (PicoC compiled via emscripten to JavaScript)
C
2
star
18

microcosm

Microcosm is usermode Unix: An implementation of a POSIX-compliant operating system as a usermode process on other operating systems. It's a way to create portable executables without a virtual machine. Works on x86_64 and ix86 processors, and a variety of host operating systems.
Shell
2
star
19

sysv-dev

The necessary components, adapted from OpenSolaris, to build working binaries for AT&T UNIX System V/386 Release 4.0 with no original C compiler system (i.e., no headers, no .a files, no crt files).
C
2
star
20

upfs

The Up Filesystem is a modern answer to umsdos: It allows you to interchangeably extend a portable but feature-poor filesystem, typically FAT32, with Unix file ownership and permissions.
C
1
star
21

ioccc2011

The development history of my 2011 IOCCC entry.
C
1
star
22

plof4

This is Plof 4, the fourth incarnation of Plof, Gregor Richards' dynamic languages playground. Plof 4 is implemented in Fythe ( http://fythe.org ).
Shell
1
star
23

style

My “style guide”
1
star
24

taskqueue

A manager for queuing UNIX tasks.
C
1
star
25

musl

musl libc (from http://www.etalabs.net/musl/), adapted to my evil needs
C
1
star
26

humidity

A suite of tools for adding human-provided expression to MIDI files, based on portmidi and midifile.
C
1
star
27

websplat

WebSplat is a web-based platformer jump-n-run game you can play in any web page!
JavaScript
1
star
28

multibot

A simple IRC bot that converts IRC input into UNIX commands to be executed, making it flexible and easily extended.
C
1
star
29

hackbot

HackBot combines multibot, UMLBox and the power of make-believe to create the world's most hackable IRC bot.
Python
1
star
30

jittefex

JIT infrastructure for research and education
C++
1
star
31

hackiki

HackBot combines Plash, mercurial and the power of make-believe to create the world's most hackable wiki.
PHP
1
star
32

livede

The LiveDE teaching development environment
JavaScript
1
star
33

exc

Extensible C: A system for writing syntactic extensions to the C programming language.
C
1
star
34

mcb-multimapsfix

[Bukkit] Plugin to fix multi-world maps
Java
1
star
35

writebuffer

Very simple programs for connecting Unix pipelines when the writer and reader are not of consistent speeds.
C
1
star
36

nibackup

Notification-based incremental backup for Linux.
C
1
star