[Haskell-cafe] Building SDL-image package on Windows
bit at mutantlemon.com
Thu Aug 28 08:38:51 EDT 2008
I think the best thing to do is to darcs send a patch with the necessary changes
On Thu, Aug 28, 2008 at 1:05 AM, Garrick Chin
<nonexistent.ftp+haskellcafe at gmail.com> wrote:
> Adding the main macro undef has solved the linker errors and both SDL_image
> and SDL_ttf build and install correctly now. For both SDL_image and SDL_ttf
> only the ./Graphics/UI/SDL/Image/Version.hsc file needed to be changed,
> pasting in the undef macro under "#include SDL_image.h" and "#include
> SDL_ttf.h" respectively. Thanks for your help!
> It would probably be a good idea to include these notes in a WIN32 file like
> for the SDL package for other users. I sent an e-mail to the listed
> maintainer on Hackage yesterday, is that the best way to about doing this?
> On Wed, Aug 27, 2008 at 4:40 AM, Bit Connor <bit at mutantlemon.com> wrote:
>> Hi, I wrote the instructions in the WIN32 file.
>> This looks like the same problem that I originally had with the SDL
>> package, mangling of "main" function in C land by the hand of the C
>> SDL.h include file.
>> If you look at the .hsc files from the SDL package, you will see the
>> fix I applied at the top of each file, after #including SDL.h the evil
>> "main" macro is undefined:
>> #include "SDL.h"
>> #ifdef main
>> #undef main
>> Probably the same must be done for all the .hsc files in SDL-image(and
>> probably also all other haskell SDL addon packages).
>> Please let me know if this information is helpful.
>> 2008/8/27 Garrick Chin <nonexistent.ftp+haskellcafe at gmail.com>:
>> > Hello,
>> > I'm trying to build the latest SDL-image package (0.5.2) from Hackage on
>> > Windows and encountering problems. These are the steps I've taken so
>> > far:
>> > 1. Downloaded SDL 1.2.13 developmental library for Mingw32 to
>> > E:\SDL-1.2.13, and SDL_image 1.2.6 developmental library for VC8 to
>> > E:\SDL_image-1.2.6.
>> > 2. Installed SDL package from Hackage, modifying the SDL.cabal
>> > according to
>> > the included WIN32 readme file and then runghc Setup.lhs
>> > configure/build/install
>> > 3. Downloaded the SDL-image package from Hackage, modified the
>> > SDL-image.cabal file to add the line "Include-Dirs:
>> > E:\SDL_image-1.2.6\include\SDL, E:\SDL-1.2.13\include\SDL" so Cabal can
>> > find
>> > the header files. After doing "runghc Setup.lhs configure", "runghc
>> > Setup.lhs build -v" gives me the following output:
>> > Creating dist\build (and its parents)
>> > Creating dist\build\autogen (and its parents)
>> > Preprocessing library SDL-image-0.5.2...
>> > Creating dist\build\Graphics\UI\SDL\Image (and its parents)
>> > E:\ghc\ghc-6.8.2\bin\hsc2hs.exe --cc=E:\ghc\ghc-6.8.2\bin\ghc.exe
>> > --ld=E:\ghc\ghc-6.8.2\bin\ghc.exe --cflag=-package --cflag=SDL-0.5.4
>> > --cflag=-package --cflag=base-126.96.36.199
>> > --cflag=-IE:\SDL_image-1.2.6\include\SDL
>> > --cflag=-IE:\SDL-1.2.13\include\SDL
>> > -o dist\build\Graphics\UI\SDL\Image\Version.hs
>> > Graphics\UI\SDL\Image\Version.hsc
>> > E:/ghc/ghc-6.8.2/libHSrts.a(Main.o)(.text+0x7):Main.c: undefined
>> > reference
>> > to `__stginit_ZCMain'
>> > E:/ghc/ghc-6.8.2/libHSrts.a(Main.o)(.text+0x36):Main.c: undefined
>> > reference
>> > to `ZCMain_main_closure'
>> > collect2: ld returned 1 exit status
>> > linking dist\build\Graphics\UI\SDL\Image\Version_hsc_make.o failed
>> > command was: E:\ghc\ghc-6.8.2\bin\ghc.exe
>> > dist\build\Graphics\UI\SDL\Image\Version_hsc_make.o -o
>> > dist\build\Graphics\UI\SDL\Image\Version_hsc_make.exe
>> > The results of a limited google search suggests that the
>> > __stginit_ZCMain
>> > linker error has to do with GHC expecting a main function, but I'm not
>> > really sure how that works in context of a library.
>> > _______________________________________________
>> > Haskell-Cafe mailing list
>> > Haskell-Cafe at haskell.org
>> > http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe