nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA FreeBSD (http://www.nvnews.net/vbulletin/forumdisplay.php?f=47)
-   -   freebsd issue compiling any program with -lopenal and -lGL (http://www.nvnews.net/vbulletin/showthread.php?t=125301)

583mdg 12-26-08 06:25 PM

freebsd issue compiling any program with -lopenal and -lGL
 
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:
Code:

int main(){
        return(1);
}

I run the following:
Code:

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

>./test.bin
Segmentation fault: 11 (core dumped)

gdb shows the following:
Code:

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

HenryHu 12-29-08 06:39 AM

Re: freebsd issue compiling any program with -lopenal and -lGL
 
try -pthread?

583mdg 01-02-09 11:41 AM

Re: freebsd issue compiling any program with -lopenal and -lGL
 
Thank you. It worked, even though I don't understand what it is.


All times are GMT -5. The time now is 09:17 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.