Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | |
| 2 | A quick-and-simple guide to installing musl: |
| 3 | |
| 4 | |
| 5 | STEP 1: Configuration |
| 6 | |
| 7 | Edit config.mak to override installation prefix, compiler options, |
Rich Felker | 0b9a1ed | 2011-02-15 14:52:11 -0500 | [diff] [blame] | 8 | target architecture, etc. as needed. Currently supported archs are |
| 9 | i386 and x86_64. Otherwise, the defaults should be okay for trying out |
| 10 | musl with static linking only. |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 11 | |
| 12 | DO NOT set the prefix to /, /usr, or even /usr/local unless you really |
| 13 | know what you're doing! You'll probably break your system such that |
| 14 | you'll no longer be able to compile and link programs against glibc! |
| 15 | This kind of setup should only be used if you're building a system |
| 16 | where musl is the default/primary/only libc. |
| 17 | |
| 18 | The default prefix is /usr/local/musl for a reason, but some people |
| 19 | may prefer /opt/musl or $HOME/musl. |
| 20 | |
| 21 | |
| 22 | STEP 2: Compiling |
| 23 | |
| 24 | Run "make". (GNU make is required.) |
| 25 | |
| 26 | |
| 27 | STEP 3: Installation |
| 28 | |
| 29 | With appropriate privileges, run "make install". |
| 30 | |
| 31 | |
| 32 | STEP 4: Using the gcc wrapper. |
| 33 | |
| 34 | musl comes with a script "musl-gcc" (installed in /usr/local/bin by |
| 35 | default) that can be used to compile and link C programs against musl. |
| 36 | It requires a version of gcc with the -wrapper option (gcc 4.x should |
| 37 | work). For example: |
| 38 | |
| 39 | cat > hello.c <<EOF |
| 40 | #include <stdio.h> |
| 41 | int main() |
| 42 | { |
| 43 | printf("hello, world!\n"); |
| 44 | return 0; |
| 45 | } |
| 46 | EOF |
| 47 | musl-gcc hello.c |
| 48 | ./a.out |
| 49 | |
| 50 | For compiling programs that use autoconf, you'll need to configure |
| 51 | them with a command like this: |
| 52 | |
| 53 | CC=musl-gcc ./configure |
| 54 | |
| 55 | Be aware that (at present) libraries linked against glibc are unlikely |
| 56 | to be usable, and the musl-gcc wrapper inhibits search of the system |
| 57 | library paths in any case. You'll need to compile any prerequisite |
| 58 | libraries (like ncurses, glib, etc.) yourself. |