1
0

INSTALL 1.8 KB

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