Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am installing a program on a server as a non-root user. Specifically it is tmux 1.5, but this should apply broadly to all locally installed program in my opinion (I mention the program name in case this problem ends up not being my own error).

The program requires me to install some dependent libraries (e.g. libevent and ncurses). So, I installed them both locally since I do not have root access

cd $HOME/library/installation/folder
DIR=$HOME/local
./configure --prefix=$DIR 
#... make ... make install 

Now, to install the program, I also had to include the library packages:

cd $HOME/program/installation/folder
./configure --prefix=$DIR CFLAGS="-I$DIR/include" LDFLAGS="-L$DIR/lib"
#... make ... make install 

Ok, so this installs the program without problems into $HOME/local/bin, but if I run the executable: $HOME/local/bin/tmux , I get the following error:

tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

It would seem to me that the program cannot find the desired libraries, but the file libevent-2.0.so.5 does indeed exist in $HOME/local/lib as specified in the configure options. I am wondering how I can get the program to recognize the installed library in order to run. I tried putting symbolic links in $HOME/lib, $HOME/bin, and $HOME/local/bin, but none of these worked. Any ideas and suggested would be greatly appreciated

share|improve this question
    
I assume -R $DIR/lib to CFLAGS is while building tmux (and not libevent). This did not help me – there was some final error from gcc saying it can't recognize -R (also, I tried without the space between -R and $DIR). ./configure --disable-shared This worked, updating the LD_LIBRARY_PATH also worked. I ended up making libevent again with the above --disable-shared option. –  user108497 Dec 7 '11 at 5:53

3 Answers 3

up vote 14 down vote accepted

Try re-building libevent using

./configure --disable-shared

I suspect this will fix your problem because the library will be linked against when building the binary and doesn't need to be searched for at runtime.

Alternatively, if you have a need for a dynamically linked libevent, you can add the containing directory of libevent-2.0.so.5 to your LD_LIBRARY_PATH environment variable:

export LD_LIBRARY_PATH=${HOME}/local/lib/:${LD_LIBRARY_PATH}
share|improve this answer
    
Wow, thanks a lot for the quick reply. I ended up using LD_LIBRARY_PATH to fix the problem since I could simply apply this fix to any future library installations and always use the $HOME/local directory. Appreciate the help! –  scicalculator Aug 18 '11 at 1:45

No luck with the others, but this worked for me, from here:

sudo ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
share|improve this answer

You could also set the RPATH, which encodes the library search patch in the binary itself.

Just add -R $DIR/lib to CFLAGS.

share|improve this answer
    
this reference is quite useful, thanks! –  scicalculator Aug 18 '11 at 1:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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