Re: problems compiling hopengl on freebsd

Sven Panne <[email protected]>
Newsgroups gmane.comp.lang.haskell.hopengl
Message-ID <[email protected]>
Chris Moline wrote:
> [...] then i tried compiling it with
> 
> gcc test.c -I/usr/X11R6/include -lSM -lICE  -L/usr/X11R6/lib -lX11 -lXext
> -lXmu -lXt -lXi  -lm -pthread -lGL
>
> this compiles with no errors. running ./a.out gives hello world!. [...]

I assume that FreeBSD uses Mesa as its OpenGL implementation. During Mesa's
build it is tested if compiling with <pthread.h> and linking with -lpthread
gives access to pthread_create. In that case, a thread-safe variant of Mesa
is built (thread-safe dispatch, per-thread OpenGL context, etc.). Of course
this requires linking any OpenGL application with pthreads.

Plausible as this explanation is, I've got no idea why the explicit
-pthread is needed only for FreeBSD, perhaps some FreeBSD guru can
enlighten me. Maybe I have to adjust the configure magic one more
time. *sigh*

The fix is simple (Bourne shell syntax):

   LDFLAGS="-pthread" ./configure

Cheers,
   S.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.