On Sun, 24 May 2009 14:07:17 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.

This is the correct behaviour.

> 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).

You might need to set LD_LIBARAY_PATH before running your program to point it 
at the correct directory with the .so file.

> 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).

It doesn't work like that.

The reason it links to libopenal.so.0 is because libopenal.so.1 will *not* be 
compatible, while also allowing multiple library versions to be installed at 
the same time. If you want your program to work on all distros, etc, then you 
need to static link the library into the program, or build one version for 
each distro linking against the correct library.

> How do I force this?
>
> Thanks,
> Aidan


Regards
Lee

Reply via email to