
Hi, I installed OpenAL and ALUT bindings downloaded from http://hackage.haskell.org/packages/archive/pkg-list.html and tried compilation of "HelloWorld.hs" example which I got from http://darcs.haskell.org/packages/ALUT/ But it returns errors as follow and I can not get an '.exe' file. Though there are clearly "link errors", I can not understand why it happens. By option "-package ALUT", libalut.a (which made by pexports and dlltool because I do not know original "alut.lib" can be used by mingw) and other necessary libraries are automatically linked, I think. What is "@8" of "alutInit@8"? How can I avoid these errors? My environment is Windows XP SP2, GHC6.6, MinGW/MSYS (so some of mingw tools are duplicated. one is GHC's, the other is MinGW's) ---------------
ghc -package ALUT HelloWorld.hs
C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x18): undefined reference to `alutInit@8' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0xdc): undefined reference to `alutInitWithoutContext@8' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x19d): undefined reference to `alutExit@0' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x1d9): undefined reference to `alutGetError@0' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x210): undefined reference to `alutCreateBufferFromFile@4' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x2b0): undefined reference to `alutCreateBufferFromFileImage@8' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x36d): undefined reference to `alutCreateBufferHelloWorld@0' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x3f7): undefined reference to `alutCreateBufferWaveform@16' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x584): undefined reference to `alutLoadMemoryFromFile@16' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x6b8): undefined reference to `alutLoadMemoryFromFileImage@20' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x7e8): undefined reference to `alutLoadMemoryHelloWorld@12' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0x92f): undefined reference to `alutLoadMemoryWaveform@28' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0xb2c): undefined reference to `alutGetMIMETypes@4' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0xbc9): undefined reference to `alutGetMajorVersion@0' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0xc01): undefined reference to `alutGetMinorVersion@0' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0xc55): undefined reference to `alutSleep@4' C:\Program Files\Haskell\ALUT-2.0\ghc-6.6/libHSALUT-2.0.a(Config.o):fake:(.text+ 0xd89): undefined reference to `alutGetErrorString@4' --------------------- -------------------- Nobuhito _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

On Sun, Mar 25, 2007 at 11:38:56AM +0900, Nobuhito Mori wrote:
Hi, I installed OpenAL and ALUT bindings downloaded from http://hackage.haskell.org/packages/archive/pkg-list.html and tried compilation of "HelloWorld.hs" example which I got from http://darcs.haskell.org/packages/ALUT/
But it returns errors as follow and I can not get an '.exe' file. Though there are clearly "link errors", I can not understand why it happens. By option "-package ALUT", libalut.a (which made by pexports and dlltool because I do not know original "alut.lib" can be used by mingw) and other necessary libraries are automatically linked, I think. What is "@8" of "alutInit@8"?
How can I avoid these errors? My environment is Windows XP SP2, GHC6.6, MinGW/MSYS (so some of mingw tools are duplicated. one is GHC's, the other is MinGW's)
@8 is name mangling, used by the (Windows-specific) calling convention for these symbols. Probably, a convention declaration was omitted in ALUT, and not noticed because it would only affect windows. Report a bug (http://hackage.haskell.org/trac/ghc/newticket?type=bug). Disclaimer: I haven't used windows in four years. Stefan

Thanks for reply. I'll report a bug if there is no new reply in two days. ------------ Nobuhito
From: Stefan O'Rear
To: Nobuhito Mori CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Link error in ALUT "Hello, World" Date: Sat, 24 Mar 2007 19:43:18 -0700 On Sun, Mar 25, 2007 at 11:38:56AM +0900, Nobuhito Mori wrote:
Hi, I installed OpenAL and ALUT bindings downloaded from http://hackage.haskell.org/packages/archive/pkg-list.html and tried compilation of "HelloWorld.hs" example which I got from http://darcs.haskell.org/packages/ALUT/
But it returns errors as follow and I can not get an '.exe' file. Though there are clearly "link errors", I can not understand why it happens. By option "-package ALUT", libalut.a (which made by pexports and dlltool because I do not know original "alut.lib" can be used by mingw) and other necessary libraries are automatically linked, I think. What is "@8" of "alutInit@8"?
How can I avoid these errors? My environment is Windows XP SP2, GHC6.6, MinGW/MSYS (so some of mingw tools are duplicated. one is GHC's, the other is MinGW's)
@8 is name mangling, used by the (Windows-specific) calling convention for these symbols. Probably, a convention declaration was omitted in ALUT, and not noticed because it would only affect windows. Report a bug (http://hackage.haskell.org/trac/ghc/newticket?type=bug). Disclaimer: I haven't used windows in four years.
Stefan
_________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

On Sun, Mar 25, 2007 at 11:56:28AM +0900, Nobuhito Mori wrote:
Thanks for reply. I'll report a bug if there is no new reply in two days.
Why do you want to wait? Reporting a bug is no more disruptive than posting on the ML .. and it's obviously not your fault, since the code isn't yours. Also, it's not listed as a bug already. (We want to know because improving the psychological aspects of the Haskell experience is very important to us.) Stefan

I thought "bug report" is more official than ML. So I wanted to make this problem more clear if possible (in other words, I'm a beginner of Haskell and I was not convinced that this problem is suited to "bug report"). Now O.K. I'll report a bug.
On Sun, Mar 25, 2007 at 11:56:28AM +0900, Nobuhito Mori wrote:
Thanks for reply. I'll report a bug if there is no new reply in two days.
Why do you want to wait?
Reporting a bug is no more disruptive than posting on the ML .. and it's obviously not your fault, since the code isn't yours.
Also, it's not listed as a bug already.
(We want to know because improving the psychological aspects of the Haskell experience is very important to us.)
Stefan
_________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

On Sun, Mar 25, 2007 at 12:24:52PM +0900, Nobuhito Mori wrote:
I thought "bug report" is more official than ML. So I wanted to make this problem more clear if possible (in other words, I'm a beginner of Haskell and I was not convinced that this problem is suited to "bug report"). Now O.K. I'll report a bug.
In general we like people to do homework, including ML queries, if you aren't sure the behaivor is wrong. But it's pretty hard to argue for the correctness of the provided example code failing to compile. :) Stefan

On Sunday 25 March 2007 04:38, Nobuhito Mori wrote:
[...] Though there are clearly "link errors", I can not understand why it happens. By option "-package ALUT", libalut.a (which made by pexports and dlltool because I do not know original "alut.lib" can be used by mingw) and other necessary libraries are automatically linked, I think. What is "@8" of "alutInit@8"? [...]
Just a little bit of background: Because Microsoft has decided that *nothing* will be easy or straightforward on their platform, they introduced tons of different calling conventions: http://msdn2.microsoft.com/en-us/library/984x0h58.aspx When a function is called, arguments are pushed onto the stack. The question is: Who cleans up the stack then, the caller or the callee? For functions with variable argument lists like printf in C the usual answer is: The caller, because it is the only one who knows what was pushed (__cdecl convetion in MS speak). OTOH, having the cleanup code in the callee leads to slightly smaller code, assuming that a function is called more than once (__stdcall in MS speak). To catch a mismatch in calling conventions at link time (and because of a few other reasons), functions expection to be called the __stdcall way get a "@BytesOnTheStackToBeCleanedUp" suffix. Historically, DLLs on Windows use the __stdcall convention, but there is no deep reason why. The OpenAL DLL uses __cdecl, but the reasons for this have probably vanished alongside Loki Software itself, the initial designers of OpenAL. ALUT is used with OpenAL, so it made sense to me to choose the same calling convention as the OpenAL DLL, i.e. __cdecl, for the ALUT DLL. Looking at the OpenAL and ALUT Haskell packages, I think that there are some cut-and-paste bugs from the OpenGL/GLUT packages (where the DLLs use __stdcall). I'll have a look at it, but in the meantime could you please add a detailed description to the corresponding ticket of how you installed the OpenAL/ALUT packages and which OpenAL/ALUT DLLs/libs you used, how you tried to convert them etc. (command lines, outputs, ...)? I'd just like to make sure that I'll reproduce exactly what you did. Cheers, S.

Thanks for reply. I appreciate your minute explanation. I understand what is the problem more clearly. I added a detailed information of my installing OpenAL/ALUT and so on, to bug report Ticket #1243.
Looking at the OpenAL and ALUT Haskell packages, I think that there are some cut-and-paste bugs from the OpenGL/GLUT packages (where the DLLs use __stdcall). I'll have a look at it, but in the meantime could you please add a detailed description to the corresponding ticket of how you installed the OpenAL/ALUT packages and which OpenAL/ALUT DLLs/libs you used, how you tried to convert them etc. (command lines, outputs, ...)? I'd just like to make sure that I'll reproduce exactly what you did.
------------- Nobuhito _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
participants (3)
-
Nobuhito Mori
-
Stefan O'Rear
-
Sven Panne