I am trying to make the postgis extension work on my system and it always spits out "$libdir/postgis2.2" no such file or directory error. For my curiosity I executed "ldd postgis-2.2.so" and it spits out the following result :

    linux-vdso.so.1 =>  (0x00007ffff3bc8000)
    /usr/lib64/libjemalloc.so.1 (0x00002b3fe5ff4000)
    libgeos_c.so.1 => not found
    libproj.so.9 => not found
    libjson-c.so.2 => not found
    libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002b3fe6237000)
    libm.so.6 => /lib64/libm.so.6 (0x00002b3fe659e000)
    libc.so.6 => /lib64/libc.so.6 (0x00002b3fe689c000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b3fe6c41000)
    /lib64/ld-linux-x86-64.so.2 (0x00002b3fe5b2e000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00002b3fe6e5d000)
    libz.so.1 => /lib64/libz.so.1 (0x00002b3fe7061000)
    liblzma.so.5 => /usr/lib64/liblzma.so.5 (0x00002b3fe7277000)

And for a bunch of dependencies I see the path to their so is not present. This I guess is happening because I am not building postgis but just copying the required so's and libs to make it work manually. But I do know the path to those so files that are required by postgis. What should I do such that I can change the "not found" in dependencies to the required path by postgis?

  • Can you edit your answer to post the output from ldconfig -v? – Josh Benson Aug 18 '16 at 5:15
  • Are those libraries already installed? Did you follow the installation instructions provided by postgis? – Julie Pelletier Aug 18 '16 at 5:27
  • I stored the so files manually including the libs and bins. – AnkitSablok Aug 18 '16 at 5:42
  • It's a hack I want urgent in my project so trying to make it work – AnkitSablok Aug 18 '16 at 5:45
  • Well make sure the libraries that it doesn't find are in a directory present in your /etc/ld.so.conf. – Julie Pelletier Aug 18 '16 at 6:16

ld.so, the dynamic linker, will use the PATH-like environment variable LD_LIBRARY_PATH when it looks for shared libraries to link at execution time.

You may set LD_LIBRARY_PATH to a :-delimited list of directories where the linker should look for libraries, for example:

$ env LD_LIBRARY_PATH="$HOME/local/lib:/opt/other/lib" ./myprog

See the ld.so manual on your system for more information.

  • I do set the LD_LIBRARY_PATH, but I still get the same error – AnkitSablok Aug 18 '16 at 21:16
  • Please update the question with more information. – Kusalananda Aug 19 '16 at 6:45
  • I was able to resolve the above issue but now I am stuck with this problem unix.stackexchange.com/questions/304362/… – AnkitSablok Aug 19 '16 at 6:52
  • @AnkitSablok Since you said this is a "hack" you could try creating a symlink to /mydb/lib/libz.so.1.2.3 called libz.so. in one of the directories searched by the linker, or just download a binary of the library for you Linux off the web. Personally, I would build everything not provided by package management tools on my system from sources. – Kusalananda Aug 19 '16 at 7:02
  • I already have the directory in which this libz.so.1.2.3 is present on my LD_LIBRARY_PATH and its still not able to find it, this is the output of ldd /usr/lib64/libxml2.so.2: libdl.so.2 (GLIBC_2.2.5) => /lib64/libdl.so.2 libz.so.1 (ZLIB_1.2.2.3) => not found libz.so.1 (ZLIB_1.2.3.3) => not found libm.so.6 (GLIBC_2.2.5) => /lib64/libm.so.6 – AnkitSablok Aug 19 '16 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.