
I'm trying to bring HOpenGL up on my new gentoo linux box. It all built fine, but any OpenGL program that tries to create a window SEGVs immediately after... OpenGL on them machine seems to work OK - I can compile and run teapots.c from the distribution for example. (Not to mention run tuxracer :-) I noted a long thread last year about --enable-threaded-rts and HOpenGL not working togther. The thread did not seem to end in a solution. The default ebuild of ghc for gentoo has this flag turned on. Might this be the cause of my problems? I was suprised when I run the SEGVing program under gdb to find that there were multiple threads in operation. Tim

Tim Docker wrote:
[...] I noted a long thread last year about --enable-threaded-rts and HOpenGL not working togther. The thread did not seem to end in a solution. The default ebuild of ghc for gentoo has this flag turned on. Might this be the cause of my problems? [...]
Yep, exactly. To recapitulate the tragic story: The current OpenGL context is a thread-local entity, but GHC's runtime system happily distributes its work load to different OS threads when it has been built with --enable-threaded-rts, but this is not correct in the presence of thread-local entities. Note that it isn't an OpenGL/GLX design flaw, and it is quite possible other libraries around do similar things. There is still some discussion about the correct way of handling this on the FFI list, especially about the semantics of the "safe", "unsafe", and "threadsafe" modifiers of foreign calls. The GHC in CVS contains a lot of modifications in this area, but I haven't tried a threaded RTS recently. So in a nutshell: Use a non-threaded RTS until the discussion has settled down and GHC & HOpenGL use whatever has been concluded... Cheers, S.

On Wed, 2003-02-26 at 09:24, Sven Panne wrote:
So in a nutshell: Use a non-threaded RTS until the discussion has settled down and GHC & HOpenGL use whatever has been concluded...
I'm pleased to say that it works fine now, at least for the simple tests that I've done. It might be worth noting in the HOpenGL doco that this flag should be turned off when building the ghc runtime - I think it was a fluke that I discovered the problem when I did. Tim
participants (2)
-
Sven Panne
-
Tim Docker