[Haskell-cafe] Trying to build a stand-alone executable GLUT app with ghc, Windows XP

Peter Schmitz ps.haskell at gmail.com
Fri Apr 25 22:05:06 EDT 2008


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

--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080425/4193c485/attachment-0001.htm


More information about the Haskell-Cafe mailing list