1
3

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 .

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?

I'm using Ubuntu 10.04 and Opensuse 10.3.

asked 18 Jun '10, 21:14

iceman's gravatar image

iceman
6159
accept rate: 0%

Please accept an answer so the question/answer can be finished. Or provide more details so we can help.

(20 Apr '11, 14:12) rfelsburg ♦



There are ./configure options for that. To install libX in /home/user/libX you would do something like this:

libx-1.0$ ./configure --prefix=/home/user

This will install to /home/user/bin, /home/user/lib, etcetera. Now, to build libY you should be able to do something like this:

liby-1.0$ ./configure --prefix=/home/user --with-libX=/home/user/lib/libX

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.

link

answered 20 Jun '10, 08:11

Sander%20Marechal's gravatar image

Sander Marechal
398116
accept rate: 29%

Using configure --prefix=/home/user/libX will create a directory hierarchy under /home/user/libX which will include lib, bin, share and so on. It's actually more common to use /opt/libX-version for this kind of thing, rather than /home/user/libX, but either works. I'll refer to this as $PREFIX.

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 bin subdirectory to PATH. If it's a library you'll need to use two different variables, one for building and the other for running.

Most libraries install a pkg-config description file which has a suffix of .pc and other software then calls pkg-config to locate the library during that software's configure stage. To enable pkg-config to find the .pc file for libX you'll need to add its directory to PKG_CONFIG_PATH. For example, set PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH. If the program isn't using pkg-config to locate libX, and doesn't accept a --with-libX=... you may be able to force it using the LIBRARY_PATH variable.

At run time, the system needs to know where to look for the libX binary (.so file). If this isn't in one of the standard places (like /lib and /usr/lib) then its directory needs to be in the LD_LIBRARY_PATH variable. For example, set LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH.

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 exec "$@"). 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.

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.

link

answered 13 Jul '10, 06:30

Neil%20Mayhew's gravatar image

Neil Mayhew
312
accept rate: 33%

edited 13 Jul '10, 06:36

I'm not sure, BTW, exactly what you meant about ffmpeg, ie whether you want to build ffmpeg from svn or make it use libraries built from svn. Either way, hopefully there's enough info here for you to be able to do what you want to do.

(13 Jul '10, 06:34) Neil Mayhew
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×14

Asked: 18 Jun '10, 21:14

Seen: 4,721 times

Last updated: 20 Apr '11, 14:12

powered by OSQA