Saturday, October 15, 2011

forcing lib location during configure

So many times I can't count, I'll compile and install an application and then the application, which compiles without errors, won't be able to locate its libraries. I know the dependencies are there, but why can't the package find its libraries when it installed them? Annoying as hell.

So I run strace <app>, find where the app is looking, run find to locate the libraries, and then create soft links. This solves the problem, but sux when I might have to create 10 or 20 softlinks.

I'd much rather avoid softlinks entirely and use "configure" options to force libs go where they will be found, but there's an apparent Catch-22: I don't know in advance which directories the application will seek its libraries until after its installation. So, although I'd like to force "configure" to install libs to those directories, how do I know where the application will seek them until I install it and attempt to run it? Additionally, is the answer within make or configure?


The answer, it would seem, is to force make to compile the app so that it both looks for its libs where I tell it to look, AND installs its libs into that location. Can it be done?

configure or make?

Theoretically, it should be possible to change the installation directories either through manipulation of make or through configure. In make it would presumably be through a configuration file make.config or some such; in configure, by forcing the prefix each time, eg.
$ configure prefix=/usr
The easier route appears to be to change it in configure. By default, make on my system appends /usr/local. This means, for example, that libs will install into /usr/local/lib. The easiest way to repair this is via configure "prefix" command as noted above. Using the command above, libs would be installed in the /usr/lib instead of /usr/local/lib. It also means however, that the bin file will install into /usr/bin instead of /usr/local/bin.


Although there's very likely something like a make.config file to change its settings, I was unable to locate such a file with some cursory searching. The fast solution appears to be forcing the issue in configure using ,eg.
$ configure prefix=/usr

No comments: