summaryrefslogtreecommitdiff
path: root/INSTALL
blob: 9e2c0061d922e3437b016ce310f001af84fdd320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

A quick-and-simple guide to installing musl:


STEP 1: Configuration

Edit config.mak to override installation prefix, compiler options,
target architecture, etc. as needed. Currently supported archs are
i386 and x86_64. Otherwise, the defaults should be okay for trying out
musl with static linking only.

DO NOT set the prefix to /, /usr, or even /usr/local unless you really
know what you're doing! You'll probably break your system such that
you'll no longer be able to compile and link programs against glibc!
This kind of setup should only be used if you're building a system
where musl is the default/primary/only libc.

The default prefix is /usr/local/musl for a reason, but some people
may prefer /opt/musl or $HOME/musl.

For shared library support, the dynamic linker pathname needs to be
hard-coded into every program you link to musl. Ideally, you should
leave the path ($syslibdir) set to /lib unless you are unable to
install files to /lib, in which case you can change it.


STEP 2: Compiling

Run "make". (GNU make is required.)


STEP 3: Installation

With appropriate privileges, run "make install".


STEP 4: Using the gcc wrapper.

musl comes with a script "musl-gcc" (installed in /usr/local/bin by
default) that can be used to compile and link C programs against musl.
It requires a version of gcc with the -wrapper option (gcc 4.x should
work). For example:

cat > hello.c <<EOF
#include <stdio.h>
int main()
{
	printf("hello, world!\n");
	return 0;
}
EOF
musl-gcc hello.c
./a.out

For compiling programs that use autoconf, you'll need to configure
them with a command like this:

CC=musl-gcc ./configure

Be aware that (at present) libraries linked against glibc are unlikely
to be usable, and the musl-gcc wrapper inhibits search of the system
library paths in any case. You'll need to compile any prerequisite
libraries (like ncurses, glib, etc.) yourself.

Note: If you want the system headers to behave something like glibc's
and expose the kitchen sink by default, you might want to try
CC="musl-gcc -D_GNU_SOURCE" instead of just CC=musl-gcc. This is
needed for compiling many programs with portability issues.