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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Peter Schmitz-4

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
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

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

Austin Seipp
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
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

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

Jeff Heard
In reply to this post by Peter Schmitz-4
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 <[hidden email]>:

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
[hidden email]
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
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe