# Does anyone have any help for a shared library conflict?



## mdg583 (Dec 29, 2008)

I am just going to post my question from here. If anyone has a better understanding of these issues, help would be nice. Or if anyone has pointers on how I can understand better what the issue is.


-----------------
-----------------


Hello. I am having trouble compiling a program with an nvidia provided libGL and the libopenal libraries in freebsd

I am running FreeBSD 7.1-RC1, GeForce4 Ti 4200 with AGP8X, and the nvidia graphics driver from ports: nvidia-driver-96.43.07. I have openal installed from ports: openal-20060211_7.

Basically, what seems to be happening is that when I compile a program dynamically linked against openal and libGL, the program segfaults whenever you try to run it.

It seems that if all openal related libraries are linked after all openGL libraries, the program is fine, but I am not sure about this. It still segfaults in some cases - maybe when other libGL libraries are linked afterward? like libGLcore.

Here is what I do to cause the problem to happen:

test.c:

```
int main(){
	return(1);
}
```

I run the following:

```
gcc -g test.c -o test.bin -L/usr/X11R6/lib/ -L/usr/local/lib -lopenal -lGL
```
The program does the following:

```
>./test.bin
Segmentation fault: 11 (core dumped)
```
gdb shows the following:

```
>gdb test.bin
...
(gdb) run
Starting program: /usr/home/matt/work/test.bin 
[New LWP 100157]

Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 100157]
0x4826a2c2 in pthread_mutexattr_setkind_np () from /lib/libthr.so.3
(gdb) backtrace
#0  0x4826a2c2 in pthread_mutexattr_setkind_np () from /lib/libthr.so.3
#1  0x480df0c3 in _nv000007gl () from /usr/local/lib/libGL.so.1
#2  0xbfbfe6c0 in ?? ()
#3  0x00000002 in ?? ()
#4  0x0000000a in ?? ()
#5  0x480df130 in _nv000007gl () from /usr/local/lib/libGL.so.1
#6  0x480df100 in _nv000007gl () from /usr/local/lib/libGL.so.1
#7  0x00000000 in ?? ()
#8  0x48079330 in ?? ()
#9  0x483b22d0 in _nv001238gl () from /usr/local/lib/libGLcore.so.1
#10 0xbfbfe728 in ?? ()
#11 0x4868409b in _nv000387gl () from /usr/local/lib/libGLcore.so.1
#12 0x00000000 in ?? ()
#13 0x48079330 in ?? ()
#14 0xbfbfe8b8 in ?? ()
#15 0x480f6dff in _init () from /usr/local/lib/libGL.so.1
#16 0xbfbfe728 in ?? ()
#17 0x48070734 in ?? () from /libexec/ld-elf.so.1
#18 0x4804e50c in dlsym () from /libexec/ld-elf.so.1
#19 0x4804f7e9 in dlopen () from /libexec/ld-elf.so.1
#20 0x4804a44e in ?? () from /libexec/ld-elf.so.1
(gdb)
```

If I swap -lopenal and -lGL, no segfault happens. But it is still happening in more complicated programs I am trying to build, where other GL libraries are being loaded, and where GL is actually being used in the program. All other cases seem to have the exact same backtrace.

Any help would be appreciated.


----------

