On Sun, 2009-05-24 at 14:07 +1200, Aidan Gauland wrote:
> Hello,
> 
> I'm trying to compile a C program linking to the genericly names shared 
> object 
> files.  The library is OpenAL, and the .so files are...
> 
> openal/src/.libs/libopenal.so
> openal/src/.libs/libopenal.so.0
> 
> ...which are symlinks to...
> openal/src/.libs/libopenal.so.0.0.0
> 
> ...it looks like the Makefile is passing the corect filename to gcc, but ldd 
> reports that the compiled executable links to "libopenal.so.0", so it, of 
> course, doesn't find it.
> 
> It's doing a similar thing with all the shared object files that it links to, 
> even the ones for which I passed the generically named symlinks, but OpenAL 
> is 
> the only one that gives me trouble (probably because the file I have 
> installed 
> on my system has a different name from the one I linked to).
> 
> I want the executable to link to generically named .so files, because I want 
> it to work with both the .so files included with the release, and whatever 
> .so 
> files are installed on the user's system (which may vary between distros, 
> even 
> with the same version of the library).
> 
> How do I force this?
> 
> Thanks,
> Aidan

I don't quite think that's what your problem is, as this is how shared
libraries should be set up. More likely is that you haven't told your
system that the new library exists...

As with most things linux, there is more than one way of setting this
up:

The most common is to create a .conf file in /etc/ld.so.conf.d - which
points to the ( absolute ) directory in which the libraries are
installed - just a single line, or more if you need them, defining that
directory. For example, I have one on my ubuntu desktop, called
libc.conf, which contains

/usr/local/lib

which is handy! Once this file is created, run ldconfig -a to update
your system. Next up, using the same mechanism, is where
the /etc/ld.co.conf.d directory doesn't exist, you'll just need to task
the directory onto the end of the file, and run ldconfig -a again.

Finally, if ldconfig doesn't exist on your system, then there is a
system variable, LD_LIBRARY_PATH, which has the same format as $PATH,
and you can tack the directory on to the end of that. There's a few
security worries about this one mind.

>From the directory path you're mentioning, you need to 

 make install 

to put those libraries in a public place, rather than just have them in
your source tree - a bit tedious when you come to using the libraries.

Hope this makes some sense,

Steve
-- 
Steve Holdoway <[email protected]>
http://www.greengecko.co.nz

Reply via email to