Answers to: Install multiple versions of a packagehttp://linuxexchange.org/questions/884/install-multiple-versions-of-a-package<p>I want to install multiple versions of a package (say libX) from src. The package (libX) uses Autotools to build, so follows the ./configure , make, make install convention. The one installed by default goes to /usr/local/bin and /usr/local/lib and I want to install another version of this in /home/user/libX .</p> <p>The other problem is that libX is a dependency for another package (say libY) which also uses autotools. How to I make libY point to the version installed in /home/user/libX ? There could be also a possibility that its a system package like ffmpeg and I want to use the latest svn version for my src code and hence build it from src. What do i do in that case ? What is the best practice in this case so that I do not break the system libraries?</p> <p>I'm using Ubuntu 10.04 and Opensuse 10.3.</p>enTue, 13 Jul 2010 06:30:12 -0400Answer by Neil Mayhewhttp://linuxexchange.org/questions/884/install-multiple-versions-of-a-package/1043<p>Using <code>configure --prefix=/home/user/libX</code> will create a directory hierarchy under <code>/home/user/libX</code> which will include <code>lib</code>, <code>bin</code>, <code>share</code> and so on. It's actually more common to use <code>/opt/libX-</code><em>version</em> for this kind of thing, rather than <code>/home/user/libX</code>, but either works. I'll refer to this as <code>$PREFIX</code>.</p> <p>To use the software you've built and installed, you'll have to set some environment variables. If it's a program, for example, you'll need to add the <code>bin</code> subdirectory to <code>PATH</code>. If it's a library you'll need to use two different variables, one for building and the other for running.</p> <p>Most libraries install a <code>pkg-config</code> description file which has a suffix of <code>.pc</code> and other software then calls <code>pkg-config</code> to locate the library during that software's <code>configure</code> stage. To enable <code>pkg-config</code> to find the .<code>pc</code> file for <code>libX</code> you'll need to add its directory to <code>PKG_CONFIG_PATH</code>. For example, set <code>PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH</code>. If the program isn't using <code>pkg-config</code> to locate <code>libX</code>, and doesn't accept a <code>--with-libX=</code>... you may be able to force it using the <code>LIBRARY_PATH</code> variable.</p> <p>At run time, the system needs to know where to look for the <code>libX</code> binary (<code>.so</code> file). If this isn't in one of the standard places (like <code>/lib</code> and <code>/usr/lib</code>) then its directory needs to be in the <code>LD_LIBRARY_PATH</code> variable. For example, set <code>LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH</code>.</p> <p>You can put these permanently into your environment, or you can create a shell script that sets them locally and then invokes a command given on the command line (eg using <code>exec "$@"</code>). I prefer using the per-command solution because you can seriously destabilize your system by using built-from-source libraries with every program you run. It's better to use them just for the programs that actually need them.</p> <p>If you find yourself using a lot of bleeding-edge libraries, you might do better to install a development or unstable version of your distro, such as Debian sid or the alpha of the next version of Ubuntu. Alternatively you might find that someone is already building advanced versions of the packages you're interested in. Ubuntu's PPA system is good for this, for example. I don't know if SUSE has anything similar.</p>Neil MayhewTue, 13 Jul 2010 06:30:12 -0400http://linuxexchange.org/questions/884/install-multiple-versions-of-a-package/1043Answer by Sander Marechalhttp://linuxexchange.org/questions/884/install-multiple-versions-of-a-package/890<p>There are ./configure options for that. To install libX in /home/user/libX you would do something like this:</p> <pre><code>libx-1.0$ ./configure --prefix=/home/user </code></pre> <p>This will install to /home/user/bin, /home/user/lib, etcetera. Now, to build libY you should be able to do something like this:</p> <pre><code>liby-1.0$ ./configure --prefix=/home/user --with-libX=/home/user/lib/libX </code></pre> <p>Check the application's documentation and build options to see what --with-XXX switches are supported. Of course, the above examples assume a standard GNU autoconf/automake application.</p>Sander MarechalSun, 20 Jun 2010 08:11:58 -0400http://linuxexchange.org/questions/884/install-multiple-versions-of-a-package/890