I am trying to compile samtools on a Solaris server where I do not have root. Samtools is zlib dependent. The zlib system on this computer does not compile with much file support, so compiling samtools against this version has the expected effect: samtools processes only small files. I need it to process large files. Fortunately, there is a version of zlib compiled by the administrator in / usr / local / apps / zlib-1.2.5 / with great file support. I can compile this by adding -R /usr/local/apps/zlib-1.2.5/lib to CFLAGS, but this does not seem to work. Symptoms are as follows:
When I try to run samtools, it crashes with this error:
ld.so.1: samtools: fatal: relocation error: file samtools: symbol gzopen64: referenced symbol not found
If I add /usr/local/apps/zlib-1.2.5/ to LD_LIBRARY_PATH, then samtools works fine.
Parsing samtools using ldd and readelf yields the following:
$ ldd -r samtools libnsl.so.1 => /usr/lib/libnsl.so.1 libsocket.so.1 => /usr/lib/libsocket.so.1 libresolv.so.2 => /usr/lib/libresolv.so.2 libm.so.2 => /usr/lib/libm.so.2 libcurses.so.1 => /usr/lib/libcurses.so.1 libz.so => /usr/lib/libz.so libc.so.1 => /usr/lib/libc.so.1 libmp.so.2 => /usr/lib/libmp.so.2 libmd.so.1 => /usr/lib/libmd.so.1 libscf.so.1 => /usr/lib/libscf.so.1 libdoor.so.1 => /usr/lib/libdoor.so.1 libuutil.so.1 => /usr/lib/libuutil.so.1 libgen.so.1 => /usr/lib/libgen.so.1 symbol not found: gzopen64 (samtools) $ ldd -s samtools ...(snip)... find object=libz.so; required by samtools search path=/usr/lib:/usr/openwin/lib:/usr/dt/lib:/usr/local/lib (LD_LIBRARY_PATH) trying path=/usr/lib/libz.so libz.so => /usr/lib/libz.so ...(snip)... $ readelf -d samtools | grep RPATH 0x0000000f (RPATH) Library rpath: [/usr/local/apps/zlib-1.2.5/lib:/usr/local/apps/gcc-4.5.1/lib]
So, /usr/local/apps/zlib-1.2.5/lib clearly located in the binary RPATH, which, as I understand it, is supposed to be searched at runtime for shared libraries. However, ldd -s indicates that this directory is never executed. Adding this path to LD_LIBRARY_PATH and re-executing the ldd commands has the expected effect: finding a directory and finding the correct version of libz.
So, how can I get samtools to search in /usr/local/apps/zlib-1.2.5/lib at runtime without using LD_LIBRARY_PATH?
Edit: The documentation here would show that the -R option is the right thing. But that does not work.
source share