1
0

INSTALL 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. A quick-and-simple guide to installing musl:
  2. STEP 1: Configuration
  3. Edit config.mak to override installation prefix, compiler options,
  4. target architecture, etc. as needed. Currently supported archs are
  5. i386 and x86_64. Otherwise, the defaults should be okay for trying out
  6. musl with static linking only.
  7. DO NOT set the prefix to /, /usr, or even /usr/local unless you really
  8. know what you're doing! You'll probably break your system such that
  9. you'll no longer be able to compile and link programs against glibc!
  10. This kind of setup should only be used if you're building a system
  11. where musl is the default/primary/only libc.
  12. The default prefix is /usr/local/musl for a reason, but some people
  13. may prefer /opt/musl or $HOME/musl.
  14. For shared library support, the dynamic linker pathname needs to be
  15. hard-coded into every program you link to musl. Ideally, you should
  16. leave the path ($syslibdir) set to /lib unless you are unable to
  17. install files to /lib, in which case you can change it.
  18. STEP 2: Compiling
  19. Run "make". (GNU make is required.)
  20. STEP 3: Installation
  21. With appropriate privileges, run "make install".
  22. STEP 4: Using the gcc wrapper.
  23. musl comes with a script "musl-gcc" (installed in /usr/local/bin by
  24. default) that can be used to compile and link C programs against musl.
  25. It requires a version of gcc with the -wrapper option (gcc 4.x should
  26. work). For example:
  27. cat > hello.c <<EOF
  28. #include <stdio.h>
  29. int main()
  30. {
  31. printf("hello, world!\n");
  32. return 0;
  33. }
  34. EOF
  35. musl-gcc hello.c
  36. ./a.out
  37. For compiling programs that use autoconf, you'll need to configure
  38. them with a command like this:
  39. CC=musl-gcc ./configure
  40. Be aware that (at present) libraries linked against glibc are unlikely
  41. to be usable, and the musl-gcc wrapper inhibits search of the system
  42. library paths in any case. You'll need to compile any prerequisite
  43. libraries (like ncurses, glib, etc.) yourself.
  44. Note: If you want the system headers to behave something like glibc's
  45. and expose the kitchen sink by default, you might want to try
  46. CC="musl-gcc -D_GNU_SOURCE" instead of just CC=musl-gcc. This is
  47. needed for compiling many programs with portability issues.