[HOpenGL] Re: [Haskell-cafe] Re: [Haskell] GHC 6.10 and OpenGL

Claus Reinke claus.reinke at talk21.com
Tue Dec 2 14:57:46 EST 2008


> I believe these errors are caused by the wrong calling convention
> being used in the Haskell bindings. This part in the configure script
> tests the build (host) platform:
> 
> case "$host" in
> *-mingw32) CALLCONV=stdcall ;;
> *)      CALLCONV=ccall ;;
> esac
> 
> Since it doesn't test for Cygwin, you end up with the calling
> convention being ccall, which leads to the linker errors because of
> associated name mangling (you would also see run-time crashes if you
> managed to somehow link your program).

Ah, that makes sense! And, indeed, for the archives, this workaround 
fixes the issue (even when building from cygwin bash):

    cabal install opengl glut --configure-option="--host=i386-unknown-mingw32" --reinstall

Thanks, now FunWorlds can ride again!-)

I suppose we could document this on the OpenGL wiki, but even
better would be a fix to OpenGL's configure (apart from checking 
the build environment (mingw) rather than the host (cygwin here), it 
should ensure that the build uses exactly what configure has tested 
successfully) or .cabal (allways setting the --host configure option 
if on windows)?

[cc-ed to hopengl list, since this seems to be an OpenGL-specific 
 issue, not a general Cabal one; Cabal++ :-]

Claus

PS of course, a high-level interpretation of the linker errors, by
    cabal or by ghc, would also help in such cases (linking object
    code is a ghc-internal detail, we work with Haskell code!-).



More information about the HOpenGL mailing list