I am running ubuntu 10.04 and I want to use tmux 1.6. tmux has a dependency on libevent 2.

My solution was to compile libevent2 and drop into /usr/local/lib then compile tmux against this lib and drop into /usr/local/bin. This works great until...I restart. This is just an assumption on my part but it seems that other binaries are now linking to the libevent2 library presumably because its on the library path. Because there are 60+ packages with libevent1 dependencies this causes my install to basically lose its mind.

Is there an idiomatic way to approach running an application that has a core library dependency on a different version? Should I just statically link the lib?

  • Check what's going on with ldd. Somewhere, you have a bad symbolic link or a misnamed file. Programs that require libevent2 should refer to libevent-2. – David Schwartz Jun 27 '12 at 14:37

http://www.ibm.com/developerworks/linux/library/l-lpic1-v3-102-3/ suggests

Loading specific libraries

If you're running an older application that needs a specific older version of a shared library, or if you're developing a new shared library or version of a shared library, you might want to override the default search paths used by the loader. This may also be needed by scripts that use product-specific shared libraries that may be installed in the /opt tree. Just as you can set the PATH variable to specify a search path for executables, you can set the LD_LIBRARY_PATH variable to a colon-separated list of directories that should be searched for shared libraries before the system ones specified in ld.so.cache. For example, you might use a command like:

export LD_LIBRARY_PATH=/usr/lib/oldstuff:/opt/IBM/AgentController/lib

The article linked to illustrates how to use ldd to find out what libraries a program depends on.


Compiled binary programs usually link against /usr/lib/libXXX.so.1.2.3

If you use a specific new version you could drop it in /usr/lib/libXXX.so.3.4.5 and your newly created program should link against this.

You can actually check, whether old programs now link against the new lib by ldd /path/to/program.

If this really happens, you can:

  • put the new lib into a separate directory /special/path/lib and
  • launch your special program with a wrapper shell script, that sets LD_LIBRARY_PATH=/special/path/lib:$LD_LIBRARY_PATH and then launches the binary or
  • if you compile your program yourself you might pass the LDFLAGS=-Wl,-rpath,/special/path/lib, this hardcodes the search path for the special lib into your program (nice because works without wrapper script)

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.