blob: 9e2c0061d922e3437b016ce310f001af84fdd320 [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
Rich Felkerf9c9d8c2011-06-27 22:34:47 -040021For shared library support, the dynamic linker pathname needs to be
22hard-coded into every program you link to musl. Ideally, you should
23leave the path ($syslibdir) set to /lib unless you are unable to
24install files to /lib, in which case you can change it.
25
Rich Felker0b44a032011-02-12 00:22:29 -050026
27STEP 2: Compiling
28
29Run "make". (GNU make is required.)
30
31
32STEP 3: Installation
33
34With appropriate privileges, run "make install".
35
36
37STEP 4: Using the gcc wrapper.
38
39musl comes with a script "musl-gcc" (installed in /usr/local/bin by
40default) that can be used to compile and link C programs against musl.
41It requires a version of gcc with the -wrapper option (gcc 4.x should
42work). For example:
43
44cat > hello.c <<EOF
45#include <stdio.h>
46int main()
47{
48 printf("hello, world!\n");
49 return 0;
50}
51EOF
52musl-gcc hello.c
53./a.out
54
55For compiling programs that use autoconf, you'll need to configure
56them with a command like this:
57
58CC=musl-gcc ./configure
59
60Be aware that (at present) libraries linked against glibc are unlikely
61to be usable, and the musl-gcc wrapper inhibits search of the system
62library paths in any case. You'll need to compile any prerequisite
63libraries (like ncurses, glib, etc.) yourself.
Rich Felkerf9c9d8c2011-06-27 22:34:47 -040064
65Note: If you want the system headers to behave something like glibc's
66and expose the kitchen sink by default, you might want to try
67CC="musl-gcc -D_GNU_SOURCE" instead of just CC=musl-gcc. This is
68needed for compiling many programs with portability issues.