Trying to build a stand-alone executable GLUT app with ghc, Windows XP

Problem summary Trying to build a stand-alone executable GLUT app with ghc, Windows XP Problem description I compile and link (without errors) a simple GLUT application under Windows XP. When I run it, XP pops an error window saying the app cannot start due to a missing "glut32.dll". I want to do a static build to create a stand-alone executable GLUT app under Windows XP, without using DLL files, or placing any files in the Windows system dir. This is my first GUI code in Haskell, and I chose GLUT because it is a standard library. Following are some details. Thanks much for any advice. Source code -- Simple GLUT app to create a window module Main(main) where import Graphics.Rendering.OpenGL import Graphics.UI.GLUT main = do (progname, _) <- getArgsAndInitialize createWindow "Hello World" mainLoop Compile/run Environment ghc-6.8.2 on a USB flashdrive under a non-admin Windows XP account ghc dir is not on C: E:\apps\ghc\ghc-6.8.2 XP shell used: cmd.exe shell path E:\ghcTest>path PATH=C:\WINDOWS\system32;C:\WINDOWS;E:\apps\ghc\ghc-6.8.2\bin;.\ ghc library path E:\ghcTest>ghc --print-libdir E:/apps/ghc/ghc-6.8.2 compile/link output E:\ghcTest>ghc --make x -package GLUT [1 of 1] Compiling Main ( x.hs, x.o ) Linking x.exe ... E:\ghcTest> files (sizes in bytes) 186 x.hs 387 x.hi 3,184 x.o 498 x.exe.manifest 609,222 x.exe When application is run Error dialog window pops up window title a.exe - Unable To Locate Component window text The application has failed to start because glut32.dll was not found. Re-installing the application may fix this problem. No output in shell; no glut window is created. Other builds tried; same runtime error ghc --make x -package GLUT -static ghc -package GLUT x.hs -o x ghc --make x -package GLUT -LE:\apps\ghc\ghc-6.8.2\lib\GLUT-2.1.1.1 ghc --make x -LE:\apps\ghc\ghc-6.8.2\lib\GLUT-2.1.1.1 --

Perhaps try: $ ghc --make -static -optl-static -l<path to libHSGLUT.a here> x.hs The -optl-static passes the '-static' argument to ld so it will link statically; you may also need a copy of a compatable GLUT library in .a format on your windows machine which should be linked in with -l as well (where you can get this, I do not know.) -- "It was in the days of the rains that their prayers went up, not from the fingering of knotted prayer cords or the spinning of prayer wheels, but from the great pray-machine in the monastery of Ratri, goddess of the Night." Roger Zelazny

Google "download glut32.dll" and pull that file down and put it in the
directory with your executable. I'd attach it myself, but gmail won't let
me. I use that all the time, though.
2008/4/25 Peter Schmitz
Problem summary
Trying to build a stand-alone executable GLUT app with ghc, Windows XP
Problem description
I compile and link (without errors) a simple GLUT application under Windows XP. When I run it, XP pops an error window saying the app cannot start due to a missing "glut32.dll".
I want to do a static build to create a stand-alone executable GLUT app under Windows XP, without using DLL files, or placing any files in the Windows system dir. This is my first GUI code in Haskell, and I chose GLUT because it is a standard library.
Following are some details. Thanks much for any advice.
Source code
-- Simple GLUT app to create a window module Main(main) where
import Graphics.Rendering.OpenGL import Graphics.UI.GLUT
main = do (progname, _) <- getArgsAndInitialize createWindow "Hello World" mainLoop
Compile/run Environment
ghc-6.8.2 on a USB flashdrive under a non-admin Windows XP account
ghc dir is not on C:
E:\apps\ghc\ghc-6.8.2
XP shell used: cmd.exe
shell path
E:\ghcTest>path
PATH=C:\WINDOWS\system32;C:\WINDOWS;E:\apps\ghc\ghc-6.8.2\bin;.\
ghc library path
E:\ghcTest>ghc --print-libdir
E:/apps/ghc/ghc-6.8.2
compile/link output
E:\ghcTest>ghc --make x -package GLUT
[1 of 1] Compiling Main ( x.hs, x.o )
Linking x.exe ...
E:\ghcTest>
files (sizes in bytes)
186 x.hs 387 x.hi 3,184 x.o 498 x.exe.manifest 609,222 x.exe
When application is run
Error dialog window pops up
window title
a.exe - Unable To Locate Component
window text
The application has failed to start because glut32.dll was not found. Re-installing the application may fix this problem.
No output in shell; no glut window is created.
Other builds tried; same runtime error
ghc --make x -package GLUT -static
ghc -package GLUT x.hs -o x
ghc --make x -package GLUT -LE:\apps\ghc\ghc-6.8.2\lib\GLUT-2.1.1.1
ghc --make x -LE:\apps\ghc\ghc-6.8.2\lib\GLUT-2.1.1.1
--
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- I try to take things like a crow; war and chaos don't always ruin a picnic, they just mean you have to be careful what you swallow. -- Jessica Edwards
participants (3)
-
Austin Seipp
-
Jefferson Heard
-
Peter Schmitz