By default programs always use the newer version of a library when two different versions of that library are installed on the OS. How is it possible to configure my system so that all apps use by default the older version of the library? Perhaps I should use ldd or ldconfig, but I’m not sure how to achieve that.
Some more details below:
I am using Xubuntu Precise and I’ve run into the following conundrum:
- Xubuntu Precise ships
libpoppler v0.18.4[1] and all Precise apps (Evince, Inkscape, etc.) are built against this version of the library. - I want to build and install ViewPDF [2] which requires
libpoppler >= v0.20. - For the reason above I backported
libpoppler v0.20.4from Ubuntu Quantal [3].
Here are the libs currently available on my system:
liv@liv-laptop:~$ locate libpoppler. | grep -i /usr/lib/
/usr/lib/x86_64-linux-gnu/libpoppler.a
/usr/lib/x86_64-linux-gnu/libpoppler.so
/usr/lib/x86_64-linux-gnu/libpoppler.so.19
/usr/lib/x86_64-linux-gnu/libpoppler.so.19.0.0
/usr/lib/x86_64-linux-gnu/libpoppler.so.28
/usr/lib/x86_64-linux-gnu/libpoppler.so.28.0.0
liv@liv-laptop:~$ ls -lh /usr/lib/x86_64-linux-gnu/libpoppler.*
-rw-r--r-- 1 root root 3.8M Sep 24 17:15 /usr/lib/x86_64-linux-gnu/libpoppler.a
lrwxrwxrwx 1 root root 20 Sep 24 17:14 /usr/lib/x86_64-linux-gnu/libpoppler.so -> libpoppler.so.28.0.0
lrwxrwxrwx 1 root root 20 Sep 4 12:35 /usr/lib/x86_64-linux-gnu/libpoppler.so.19 -> libpoppler.so.19.0.0
-rw-r--r-- 1 root root 2.0M Mar 1 2012 /usr/lib/x86_64-linux-gnu/libpoppler.so.19.0.0
lrwxrwxrwx 1 root root 20 Sep 24 17:14 /usr/lib/x86_64-linux-gnu/libpoppler.so.28 -> libpoppler.so.28.0.0
-rw-r--r-- 1 root root 2.4M Sep 24 17:15 /usr/lib/x86_64-linux-gnu/libpoppler.so.28.0.0
Now building and running ViewPDF works just fine. The big problem, however, is that some of the apps (xpdf, inkscape) originally built against 0.18.4 are broken.
So here’s my question:
How is it possible to configure my system so that all apps use by default the older version of the poppler library (libpoppler.so.19.0.0); and only the apps specifically built against the newer version (libpoppler.so.28.0.0) to use the most recent version? Perhaps I should use ldd or ldconfig but I’m not sure how to achieve that.
Installl everything you build from sources to
/usr/local, as per the default prefix ofconfigure.Update: if you plan to distribute this package further, then a different approach is needed. I would create a directory named say
/usr/lib/futureand place an advanced version oflibpoppler.sothere. The application would link against it, using the-rpath=/usr/lib/futureand possibly-rpath-link=/usr/lib/future.