X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=INSTALL;h=5c923ee59df8e55696e177c7b266da28f206ab14;hp=5b58693eb749ca598875ed61b964ada9174a493c;hb=b72db3d1ed561d31d059acc7e9a5aacb8c5ee9ac;hpb=7dd86ec16852cf189e88fb2829caee4e114087e7 diff --git a/INSTALL b/INSTALL index 5b58693e..5c923ee5 100644 --- a/INSTALL +++ b/INSTALL @@ -19,7 +19,7 @@ First, some prerequisites: you don't need threads or POSIX 2008 features, even 2.4 is probably okay. -- A supported CPU architecture (currently i386, x86_64, or arm). +- A supported CPU architecture (currently i386, x86_64, arm, or mips). - If you want to use dynamic linking, it's recommended that you have permissions to write to /lib and /etc. Otherwise your binaries will @@ -36,9 +36,16 @@ to compile and link programs and libraries against musl. To install musl as an alternate libc, follow these steps: -1. Edit config.mak to select your system's CPU architecture (i386, - x86_64, or arm), installation prefix, location for the dynamic - linker, and other build preferences. +1. Configure musl's build with a command similar to: + ./configure --prefix=/usr/local/musl --exec-prefix=/usr/local + Refer to ./configure --help for details on other options. You may + change the install prefix if you like, but DO NOT set it to a + location that contains your existing libraries based on another + libc such as glibc or uClibc. If you do not intend to use dynamic + linking, you may disable it at this point via --disable-shared and + cut the build time in half. If you wish to use dynamic linking but + do not have permissions to write to /lib, you will need to set an + alternate dynamic linker location via --syslibdir. 2. Run "make". Parallel build is fully supported, so you can instead use "make -j3" or so on SMP systems if you like. @@ -46,10 +53,13 @@ To install musl as an alternate libc, follow these steps: 3. Run "make install" as a user sufficient privileges to write to the destination. -4. Ensure that /etc/ld-musl-$ARCH.path (where $ARCH is replaced by - i386, x86_64, etc. as appropriate) contains the correct search path - for where you intend to install musl-linked shared library files. - This step can be skipped if you disabled dynamic linking. +4. Create a file named /etc/ld-musl-$ARCH.path (where $ARCH is + replaced by i386, x86_64, etc. as appropriate) containing the + correct colon-delimited search path for where you intend to install + musl-linked shared library files. If this file is missing, musl + will search the standard path, and you will encounter problems when + it attempts to load libraries linked against your host libc. Note + that this step can be skipped if you disabled dynamic linking. After installing, you can use musl via the musl-gcc wrapper. For example: @@ -66,14 +76,9 @@ musl-gcc hello.c ./a.out To configure autoconf-based program to compile and link against musl, -you may wish to use: +set the CC variable to musl-gcc when running configure, as in: -CC="musl-gcc -D_GNU_SOURCE" ./configure ... - -Correctly-written build systems should not need -D_GNU_SOURCE as part -of $CC, but many programs do not use feature-test macros correctly and -simply assume the compiler will automatically give them the kitchen -sink, so the above command is an easy workaround. +CC=musl-gcc ./configure ... You will probably also want to use --prefix when building libraries to ensure that they are installed under the musl prefix and not in the @@ -81,8 +86,9 @@ main host system library directories. Finally, it's worth noting that musl's include and lib directories in the build tree are setup to be usable without installation, if -necessary. Just modify the musl-gcc wrapper's libc_prefix variable to -point to the source/build tree. +necessary. Just modify the the paths in the spec file used by musl-gcc +(it's located at $prefix/lib/musl-gcc.specs) to point to the +source/build tree. @@ -107,10 +113,9 @@ TO CONVERT IT TO BE A MUSL-BASED SYSTEM!! the search path before you move them, or your system will break badly and you will not be able to continue. -2. Edit musl's config.mak and set the installation prefix to the - prefix your compiler toolchain is configured to search, probably - /usr. Set ARCH to match your CPU architecture, and change any other - options as you see fit. +2. Configure musl's build with a command similar to: + ./configure --prefix=/usr --disable-gcc-wrapper + Refer to ./configure --help for details on other options. 3. Run "make" to compile musl. @@ -130,9 +135,3 @@ dynamic linker (program interpreter) is /lib/ld-musl-$ARCH.so.1. If you're using static linking only, you might instead check the symbols and look for anything suspicious that would indicate your old glibc or uClibc was used. - -When building programs against musl, you may still want to ensure the -appropriate feature test macros get defined, as in: - -CC="gcc -D_GNU_SOURCE" ./configure ... -