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