NOTES.UNIX 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. NOTES FOR UNIX LIKE PLATFORMS
  2. =============================
  3. For Unix/POSIX runtime systems on Windows, please see NOTES.WIN.
  4. Shared libraries and installation in non-standard locations
  5. -----------------------------------------------------------
  6. Binaries on Unix variants expect to find shared libraries in standard
  7. locations, such as /usr/lib, /usr/local/lib and some other locations
  8. configured in the system (for example /etc/ld.so.conf on some systems).
  9. If the libraries are installed in non-standard locations, binaries
  10. will not find them and therefore fail to run unless they get a bit of
  11. help from a defined RPATH or RUNPATH. This can be applied by adding
  12. the appropriate linker flags to the configuration command, such as
  13. this (/usr/local/ssl was the default location for OpenSSL installation
  14. in versions before 1.1.0):
  15. $ ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \
  16. -Wl,-rpath,/usr/local/ssl/lib
  17. Because the actual library location may vary further (for example on
  18. multilib installations), there is a convenience variable in Makefile
  19. that holds the exact installation directory and that can be used like
  20. this:
  21. $ ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \
  22. -Wl,-rpath,'$(LIBRPATH)'
  23. On modern systems using GNU ld.so, a better choice may be to use the
  24. new dtags, like this:
  25. $ ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl \
  26. -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)'
  27. This sets DT_RUNPATH instead of DT_RPATH. DT_RUNPATH is considered after
  28. the environment variable LD_LIBRARY_PATH, while DT_RPATH is considered
  29. before that environment variable (which means that the values in that
  30. environment variable won't matter if the library is found in the
  31. paths given by DT_RPATH).