[Haskell-cafe] Installation of GLUT package

Ronald Guida ronguida at mindspring.com
Sat Sep 8 16:16:12 EDT 2007


Update:

I downloaded MinGW and MSYS and tried to install the GLUT library.  I
just can't get the thing to work, and I feel like I'm sitting in my
own little section of Hell.

I have tried everything I could think of so far, and it still doesn't work.

Today I tried to sanitize my machine and start over.  Here is my
sequence of steps.  Can anyone tell me what I'm doing wrong?

-- Ron

1. Try to sanitize the machine.
  * Uninstall GHC, then delete C:\ghc and C:\Program Files\Haskell
  * Uninstall MSYS-DTK, MSYS, MinGW, then delete C:\MinGW and C:\MSYS
  * Verify that there is no glut*.dll in C:\Windows\System[32]
  * Delete C:\freeglut and C:\GLUT

2. Reboot.

3. Obtain the following files:

      Note: If I already downloaded a file, I saved it to avoid
      downloading again.

[1] GHC windows executable
    http://haskell.org/ghc/dist/6.6.1/ghc-6.6.1-i386-windows.exe

[2] FreeGlut
    
http://superb-west.dl.sourceforge.net/sourceforge/freeglut/freeglut-2.4.0.tar.gz

[3] Haskell GLUT library
    http://hackage.haskell.org/packages/archive/GLUT/2.0/GLUT-2.0.tar.gz

[4] Automated MinGW installer
    
http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe?modtime=1168811236&big_mirror=1

[5] MSYS: Minimal System installer
    
http://downloads.sourceforge.net/mingw/MSYS-1.0.10.exe?modtime=1079444447&big_mirror=1

[6] MSYS: Supplementary Tools installer
    
http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe?modtime=1041430674&big_mirror=1

[7] The RotatingCubes example, modified by adding an actionOnWindowClose
    in order to verify that FreeGlut is actually being used.
    http://hpaste.org/2632

3. Install GHC by running [1].

4. Open a command window (Start->Run, type "cmd", click OK)

5. See what packages came with GHC.

C:\Documents and Settings\Ron> ghc-pkg list
C:/ghc/ghc-6.6.1\package.conf:
    Cabal-1.1.6.2, GLUT-2.1.1, HUnit-1.1.1, OpenGL-2.2.1,
    QuickCheck-1.0.1, Win32-2.1.1, base-2.1.1, cgi-3001.1.1, fgl-5.4.1,
    filepath-1.0, (ghc-6.6.1), haskell-src-1.0.1, haskell98-1.0,
    html-1.0.1, mtl-1.0.1, network-2.0.1, parsec-2.0, regex-base-0.72,
    regex-compat-0.71, regex-posix-0.71, rts-1.0, stm-2.0,
    template-haskell-2.1, time-1.1.1, xhtml-3000.0.2

** Puzzle: Why does GHC have GLUT-2.2.1 if the latest verion of the
   GLUT library [3] is GLUT-2.0?

6. Try to run the modified RotatingCubes example [7], it should fail
   because I have neither GLUT not FreeGlut installed.

C:\Documents and Settings\Ron> cd C:\RotatingCube

C:\RotatingCube>ghci RotatingCube.lhs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( RotatingCube.lhs, interpreted )
Ok, modules loaded: Main.
*Main> :main
Loading package haskell98 ... linking ... done.
Loading package OpenGL-2.2.1 ... linking ... done.
Loading package GLUT-2.1.1 ... can't load .so/.DLL for: glut32 (addDLL: 
unknown
error)
*Main> :q
Leaving GHCi.

7. Unzip the freeglut package [2] into C:\freeglut and then open the
   C:\freeglut\freeglut-2.4.0\freeglut.dsw file with Microsoft Visual
   Studio 2003.  Select "Yes to all" when asked to convert to 2003
   format.

8. In VS 2003 main menu: select Build -> Batch Build, then click
   "Select All", then click "Build".

      VS 2003: Build: 4 succeeded, 0 failed, 0 skipped

9. Close VS 2003.

10. Copy and rename
    from: C:\freeglut\freeglut-2.4.0\Release\freeglut.dll
    to:   C:\WINDOWS\SYSTEM32\glut32.dll

11. Try to run the modified RotatingCubes example [7] again.

C:\RotatingCube>ghci RotatingCube.lhs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( RotatingCube.lhs, interpreted )
Ok, modules loaded: Main.
*Main> :main
Loading package haskell98 ... linking ... done.
Loading package OpenGL-2.2.1 ... linking ... done.
Loading package GLUT-2.1.1 ... linking ... done.
*** Exception: user error (unknown GLUT call glutSetOption, check for 
freeglut)
*Main> :q
Leaving GHCi.

12. Copy C:\freeglut\freeglut-2.4.0\include\GL\*.h
    to   C:\ghc\ghc-6.6.1\include\mingw\GL\
    Note: glut.h will be overwritten

13. Try to run the modified RotatingCubes example [7] again.
    (It fails, exactly as in step 11.)

14. Run the MinGW installer [4].  Select "Full Install", leave
    everything else at its default value.

15. Run the MSYS installer [5].  Leave everything at default values.
  * Post Install Q & A:
      Do you wish to continue with the post install? [yn ] y

      Do you have MinGW installed? [yn ] y

      Please answer the following in the form of c:/foo/bar.
      Where is your MinGW installation? c:/MinGW

16. Run the MSYS Supplementary Tools installer [6].  Leave everything
    at default values.

17. Unzip the Haskell GLUT library into C:\GLUT; this creates the
    folder C:\GLUT\GLUT-2.0.

18. Start MSYS using the desktop shortcut installed in step 15.

19. Execute the following commands in the MSYS shell.
  $ cd /c/GLUT/GLUT-2.0/

  $ runghc Setup.hs configure
configure: WARNING: no GLUT header found, so this package will not be built
configure: creating ./config.status

  $ runghc Setup.hs build
Setup.hs: Package GLUT-2.0 can't be built on this system.

20. Copy C:\freeglut\freeglut-2.4.0\include\GL\*.h
    to   C:\MinGW\include\GL

21. Execute the following commands in the MSYS shell.
  $ cd /c/GLUT/GLUT-2.0/

  $ runghc Setup.hs configure

  $ runghc Setup.hs build
Warning: resolving _hs_GLUT_getProcAddress at 4 by linking to 
_hs_GLUT_getProcAddress
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups

  $ runghc Setup.hs install
Installing: C:\Program Files\Haskell\GLUT-2.0\ghc-6.6.1 & C:\Program 
Files\Haskell\bin GLUT-2.0...
Registering GLUT-2.0...
Reading package info from ".installed-pkg-config" ... done.
Saving old package config file... done.
Writing new package config file... done.

22. Try to run the modified RotatingCubes example [7] again.

C:\RotatingCube>ghci RotatingCube.lhs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( RotatingCube.lhs, interpreted )
Ok, modules loaded: Main.
*Main> :main
Loading package haskell98 ... linking ... done.
Loading package OpenGL-2.2.1 ... linking ... done.
Loading package GLUT-2.1.1 ... linking ... done.
*** Exception: user error (unknown GLUT call glutSetOption, check for 
freeglut)
*Main> :q
Leaving GHCi.

22-b. Scratch head.

23. Copy from C:\Program Files\Haskell\GLUT-2.0\ghc-6.6.1\
           to C:\ghc\ghc-6.6.1\
        files HSGLUT-2.0.o and libHSGLUT-2.0.a

24. Copy C:\Program Files\Haskell\GLUT-2.0\ghc-6.6.1\include\HsGLUT.h
      to C:\ghc\ghc-6.6.1\include
    Note: This will overwrite the previous file.

25. Copy the C:\Program Files\Haskell\GLUT-2.0\ghc-6.6.1\Graphics\UI
    directory to C:\ghc\ghc-6.6.1\imports\Graphics.
    This will overwrite lots of files.

26. Try to run the modified RotatingCubes example [7] again.

C:\RotatingCube>ghci RotatingCube.lhs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( RotatingCube.lhs, interpreted )

RotatingCube.lhs:4:1:
    Bad interface file: C:/ghc/GHC-66~1.1\imports/Graphics/UI/GLUT.hi
        Something is amiss; requested module  
GLUT-2.1.1:Graphics.UI.GLUT differ
s from name found in the interface file GLUT-2.0:Graphics.UI.GLUT
Failed, modules loaded: none.
Prelude> :q
Leaving GHCi.

26-b. Pull hair in frustration.  Try re-building GLUT-2.0.

27. Delete C:\GLUT\GLUT-2.0 and C:\Program Files\Haskell\GLUT-2.0

28. Unzip the Haskell GLUT library into C:\GLUT; this creates the
    folder C:\GLUT\GLUT-2.0.

29. Start MSYS using the desktop shortcut installed in step 15.

30. Execute the following commands in the MSYS shell.
  $ cd /c/GLUT/GLUT-2.0/

  $ runghc Setup.hs configure

  $ runghc Setup.hs build
Warning: resolving _hs_GLUT_getProcAddress at 4 by linking to 
_hs_GLUT_getProcAddress
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups

  $ runghc Setup.hs install
Installing: C:\Program Files\Haskell\GLUT-2.0\ghc-6.6.1 & C:\Program 
Files\Haskell\bin GLUT-2.0...
Registering GLUT-2.0...
Reading package info from ".installed-pkg-config" ... done.
Saving old package config file... done.
Writing new package config file... done.

31. Try to run the modified RotatingCubes example [7] again.

C:\RotatingCube>ghci RotatingCube.lhs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( RotatingCube.lhs, interpreted )

RotatingCube.lhs:4:1:
    Bad interface file: C:/ghc/GHC-66~1.1\imports/Graphics/UI/GLUT.hi
        Something is amiss; requested module  
GLUT-2.1.1:Graphics.UI.GLUT differ
s from name found in the interface file GLUT-2.0:Graphics.UI.GLUT
Failed, modules loaded: none.
Prelude> :q
Leaving GHCi.

32. Give up and beg for help :)



More information about the Haskell-Cafe mailing list