Profanity: Error while loading shared libraries

Created on 14 Jun 2015  Â·  3Comments  Â·  Source: profanity-im/profanity

After successfully building on CentOS 6.6:

PLATFORM       : linux-gnu
PACKAGE_STATUS : release
AM_CFLAGS      : -Wall -Wno-deprecated-declarations
AM_CPPFLAGS    :  -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DTHEMES_PATH="\"${pkgdatadir}/themes\""
LIBS           : -lglib-2.0 -lcurl -lncursesw -lstrophe -lssl -lcrypto -lxml2 -lresolv 
XML Parser     : libxml2
Install themes : true
Themes path    : ${pkgdatadir}/themes

Now you can run `make' to build profanity

$ make
...
$ make install
...
$ profanity
profanity: error while loading shared libraries: libstrophe.so.0: cannot open shared object file: No such file or directory

It's unclear what happened here, as everything built seemingly fine.

Most helpful comment

@Ubiquitous, you must be installed libstrophe manually from sources. In this case you need to run sudo ldconfig to rebuild library cache. When you install libraries with package manager it runs this command automatically, so you don't experience the problem.

How ldconfig works... It scans all directories from file /etc/ld.so.conf (ensure, you have /usr/local/lib there), creates a cache of existent libraries and writes it to /etc/ld.so.cache. When system needs to load a library it looks for .so file in LD_LIBRARY_PATH first and then in the library cache.

Your solution works, because LD_LIBRARY_PATH contains /usr/local/lib, but this is not proper way. LD_LIBRARY_PATH should not be used for standard paths like /usr/lib.

Hope, it will help.

All 3 comments

This is probably an issue with the library loader path. When building libstrophe, if you do:

./configure --prefix=/usr

I think this might fix the issue, by default libstrophe is installed to /usr/local. The following link is sort of relevant: http://unix.stackexchange.com/questions/67781/use-shared-libraries-in-usr-local-lib

Let me know if this helps.

In addition to your suggestion I needed to do the following first:

export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib

followed by:

./configure --prefix=/usr

— Profanity now executes properly, thank you!

@Ubiquitous, you must be installed libstrophe manually from sources. In this case you need to run sudo ldconfig to rebuild library cache. When you install libraries with package manager it runs this command automatically, so you don't experience the problem.

How ldconfig works... It scans all directories from file /etc/ld.so.conf (ensure, you have /usr/local/lib there), creates a cache of existent libraries and writes it to /etc/ld.so.cache. When system needs to load a library it looks for .so file in LD_LIBRARY_PATH first and then in the library cache.

Your solution works, because LD_LIBRARY_PATH contains /usr/local/lib, but this is not proper way. LD_LIBRARY_PATH should not be used for standard paths like /usr/lib.

Hope, it will help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eduncan911 picture eduncan911  Â·  7Comments

boothj5 picture boothj5  Â·  4Comments

jubalh picture jubalh  Â·  8Comments

moppman picture moppman  Â·  3Comments

SteveGZr picture SteveGZr  Â·  9Comments