Re: [Haskell-cafe] Installation of GLUT package

2007-09-10 Thread Paul L
On 9/9/07, Ronald Guida <[EMAIL PROTECTED]> wrote:
> Good news:
>
> I abandoned GLUT and looked at GLFW.  I had similar problems getting
> GLFW to work with GHC and GHCi.  After a bunch of hacking, I got GLFW
> to work for me.

Glad to hear it, but please let me know what problems you had.

GLFW doesn't require MinGW/MSYS to compile. But since you have MinGW,
you need to make sure PATH contains ghc-lib directory, and it must
come before MinGW's path, because GHC and MinGW may be using different
binutils.

> I have to invoke GHCi with the command line [1] and I have to invoke
> the compiler like [2], but hey, it works :)
>
>  [1] "ghci  glfw_hack.o -lopengl32 -lglu32"
>  [2] "ghc --make  glfw_hack.o -lopengl32 -lglu32"

It seems that you have not been able to install the GLFW module. Which
step of the Setup.hs configure/build/intall went wrong?

Regards
Paul Liu
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-09 Thread Ronald Guida

Paul L wrote:
> But again, why stuck with GLUT? Now there is at least one alternative,
> GLFW (http://glfw.sourceforge.net) a cross-platform framework for
> OpenGL applications, for which I recently wrote a Haskell interface,
> downloadable at http://www.haskell.org/soe/software1.htm. It's
> certainly experimental though. The GLFW C library itself is well
> documented, but the Haskell module still isn't. The only example so
> far is the soe.hs in the SOE package.

Good news:

I abandoned GLUT and looked at GLFW.  I had similar problems getting
GLFW to work with GHC and GHCi.  After a bunch of hacking, I got GLFW
to work for me.

I have to invoke GHCi with the command line [1] and I have to invoke
the compiler like [2], but hey, it works :)

[1] "ghci  glfw_hack.o -lopengl32 -lglu32"
[2] "ghc --make  glfw_hack.o -lopengl32 -lglu32"

-- Ron


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-09 Thread Paul L
On 9/8/07, Ronald Guida <[EMAIL PROTECTED]> wrote:

> Clearly, I'm missing something here.  Where do I have to go to get the
> latest version of GLUT?

You can get it using darcs:

darcs get http://darcs.haskell.org/packages/GLUT/

> Also, after I built freeglut with VS-2003, I copied the include files,
> the lib file, and the dll to the correct places (relative to VS-2003)
> and I could successfully compile the examples that came with freeglut.
> MinGW/MSYS doesn't know about VS-2003 include directories, so where am
> I supposed to put the freeglut include and lib files relative to
> MinGW/MSYS?

Maybe put the include files in /MinGW/include? I'm not sure if you
need the lib or dll files for compilation, as it's dynamically linked.
But I could be wrong, as MinGW barely works on my Vista.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-09 Thread Claus Reinke

>> Loading package OpenGL-2.2.1 ... linking ... done.
>> Loading package GLUT-2.1.1 ... linking ... done.
>
> The above message was after you have installed GLUT-2.0, but GHC was
> still loading GLUT-2.1.1. The later errors were caused by your forced
> copy of 2.0 lib over the default 2.1.1.

I noticed this myself.  The problem is, I don't know where to get
GLUT-2.1.1.  If I look on Hackage [1] and select GLUT from the
Graphics category, I am directed to GLUT-2.0.
[1] http://hackage.haskell.org/packages/archive/pkg-list.html


the messages indicate that you already have GLUT-2.1.1
somewhere, even installed at some point. for the latest
sources, 

   http://www.haskell.org/haskellwiki/Opengl 


should give the correct pointers (btw, the hopengl mailinglist
specifically covers these topics and, being low-traffic, has a
better chance of reaching Sven, whenever he catches up with
haskell-related email). 

in contrast to the hopengl home page, which is outdated, the link 
above is on the wiki, and is meant to collect information that usually 
puzzles new hopengl users. so if one of those who have successfully 
replaced glut with freeglut on windows (or other platforms) could 
add instructions to that page, that would be useful. from Ron's log,

it appears that simply replacing the dll does not quite work?

claus

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-08 Thread Ronald Guida

Paul L wrote:
> I believe it's caused by the different versions of GLUT you have.
>
> On 9/8/07, Ronald Guida <[EMAIL PROTECTED]> wrote:
>> [...]
>> Loading package OpenGL-2.2.1 ... linking ... done.
>> Loading package GLUT-2.1.1 ... linking ... done.
>
> The above message was after you have installed GLUT-2.0, but GHC was
> still loading GLUT-2.1.1. The later errors were caused by your forced
> copy of 2.0 lib over the default 2.1.1.

I noticed this myself.  The problem is, I don't know where to get
GLUT-2.1.1.  If I look on Hackage [1] and select GLUT from the
Graphics category, I am directed to GLUT-2.0.
[1] http://hackage.haskell.org/packages/archive/pkg-list.html

> I suggest you get the cabal version of latest GLUT, which is 2.1.1,
> and build it from source. I did the same on Linux some time ago, and I
> was able to use freeGLUT and openGLUT as a result.

Clearly, I'm missing something here.  Where do I have to go to get the
latest version of GLUT?

Also, after I built freeglut with VS-2003, I copied the include files,
the lib file, and the dll to the correct places (relative to VS-2003)
and I could successfully compile the examples that came with freeglut.
MinGW/MSYS doesn't know about VS-2003 include directories, so where am
I supposed to put the freeglut include and lib files relative to
MinGW/MSYS?

Thank you
-- Ron

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-08 Thread Paul L
I believe it's caused by the different versions of GLUT you have.

On 9/8/07, Ronald Guida <[EMAIL PROTECTED]> wrote:
> [...]
> Loading package OpenGL-2.2.1 ... linking ... done.
> Loading package GLUT-2.1.1 ... linking ... done.

The above message was after you have installed GLUT-2.0, but GHC was
still loading GLUT-2.1.1. The later errors were caused by your forced
copy of 2.0 lib over the default 2.1.1.

I suggest you get the cabal version of latest GLUT, which is 2.1.1,
and build it from source. I did the same on Linux some time ago, and I
was able to use freeGLUT and openGLUT as a result.

But again, why stuck with GLUT? Now there is at least one alternative,
GLFW (http://glfw.sourceforge.net) a cross-platform framework for
OpenGL applications, for which I recently wrote a Haskell interface,
downloadable at http://www.haskell.org/soe/software1.htm. It's
certainly experimental though. The GLFW C library itself is well
documented, but the Haskell module still isn't. The only example so
far is the soe.hs in the SOE package.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-08 Thread Ronald Guida

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=107947&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 T

Re: [Haskell-cafe] Installation of GLUT package

2007-09-04 Thread Paul L
hs_GLUT_getProcAddress in cbits/HsGLUT.c apparently requires FREEGLUT
or GLUT_API_VERSION >= 5 or OPENGLUT to be defined at compile time in
order to work, as the standard GLUT 3.7 doesn't even have the
glutGetProcAddress(..) function.

Regards,
Paul Liu

On 9/4/07, Sven Panne <[EMAIL PROTECTED]> wrote:
> On Tuesday 04 September 2007 15:37, Paul L wrote:
> > The detection of freeglut or glut is at compile time by checking if
> > some function exists. Otherwise it's not able to link. So you'll have
> > to re-compile the Haskell GLUT package.
>
> Show me the code where the alleged tests are made, please... :-) The only
> things which are determined at build time are the linker options for linking
> OpenGL/GLUT applications and the calling convention on the platform in
> question. If you change your GLUT DLL to a freeglut DLL, everything should
> work, including freeglut extensions. If not, I consider this as a bug and
> I'll try to fix it. But to see what's going on, some logs, commandlines, etc.
> are needed to reproduce what other people have done.
>
> For a more detailed discussion, perhaps the hopengl list might be more
> appropriate.
>
> Cheers,
>S.
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-04 Thread Sven Panne
On Tuesday 04 September 2007 15:37, Paul L wrote:
> The detection of freeglut or glut is at compile time by checking if
> some function exists. Otherwise it's not able to link. So you'll have
> to re-compile the Haskell GLUT package.

Show me the code where the alleged tests are made, please... :-) The only 
things which are determined at build time are the linker options for linking 
OpenGL/GLUT applications and the calling convention on the platform in 
question. If you change your GLUT DLL to a freeglut DLL, everything should 
work, including freeglut extensions. If not, I consider this as a bug and 
I'll try to fix it. But to see what's going on, some logs, commandlines, etc. 
are needed to reproduce what other people have done.

For a more detailed discussion, perhaps the hopengl list might be more 
appropriate.

Cheers,
   S.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-04 Thread Paul L
On 9/4/07, Sven Panne <[EMAIL PROTECTED]> wrote:
> But coming to the main point: I can't see a reason why the GLUT package needs
> to be rebuilt, it gets the freeglut-specific API entries dynamically (at
> least, that was the plan ;-). Replacing the original GLUT DLL with the
> freeglut DLL should work. because freeglut *is* a drop-in replacement for the
> old GLUT (modulo support for some obscure input devices). A more detailed
> description of what goes wrong with that simple approach would be helpful...

The detection of freeglut or glut is at compile time by checking if
some function exists. Otherwise it's not able to link. So you'll have
to re-compile the Haskell GLUT package.

Regards,
Paul Liu
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-03 Thread Sven Panne
On Tuesday 04 September 2007 03:06, Ronald Guida wrote:
> [...]
> According to Cabal/How_to_install_a_Cabal_package, I need to download
> the package, unzip it, and then run the following three commands.
>
> 1. runghc Setup.hs configure
> 2. runghc Setup.hs build
> 3. runghc Setup.hs install
>
> The first command, "runghc Setup.hs configure", fails, reporting that
> it can't find "sh".  Naturally, I'm on a Windows box, so I don't have
> the Unix shell on my system.
>
> So now I'm stuck...
>
> * Is there an easy way to work around the absence of "sh"?

No, the GLUT package uses autoconf at build time, so you need "sh".

> * Is there an easy way to get "sh" on my Windows box?

MinGW/MSYS is the way to go if you really want to build any autoconf-based SW 
on Windows. Cygwin is normally not needed and it's a totally different beast.

> [...]
> PS, Here's the output of configure.  Do I really need all this stuff
> just for the GLUT package?
>
> C:\GLUT\GLUT-2.0>runghc Setup.hs configure
> Configuring GLUT-2.0...
> configure: Dependency base-any: using base-2.1.1
> configure: Dependency OpenGL-any: using OpenGL-2.2.1
> configure: Using install prefix: C:\Program Files
> configure: Binaries installed in: C:\Program Files\Haskell\bin
> configure: Libraries installed in: C:\Program
> Files\Haskell\GLUT-2.0\ghc-6.6.1
> configure: Private binaries installed in: C:\Program Files\GLUT-2.0
> configure: Data files installed in: C:\Program Files\Common Files\GLUT-2.0
> configure: Using compiler: C:\ghc\ghc-6.6.1\bin\ghc.exe
> configure: Compiler flavor: GHC
> configure: Compiler version: 6.6.1
> configure: Using package tool: C:\ghc\ghc-6.6.1\bin\ghc-pkg.exe
> configure: Using ar found on system at: C:\ghc\ghc-6.6.1\bin\ar.exe
> configure: No haddock found
> configure: No pfesetup found
> configure: No ranlib found
> configure: Using runghc found on system at: C:\ghc\ghc-6.6.1\bin\runghc.exe
> configure: No runhugs found
> configure: No happy found
> configure: No alex found
> configure: Using hsc2hs: C:\ghc\ghc-6.6.1\bin\hsc2hs.exe
> configure: No c2hs found
> configure: No cpphs found
> configure: No greencard found
> Setup.hs: Cannot find: sh

This is standard Cabal output, nothing specific to the GLUT package. Hint: 
Don't even think about path names with spaces when building any 
autoconf-based SW, this will most certainly go wrong. Installing a path with 
spaces via Cabal should be OK.

But coming to the main point: I can't see a reason why the GLUT package needs 
to be rebuilt, it gets the freeglut-specific API entries dynamically (at 
least, that was the plan ;-). Replacing the original GLUT DLL with the 
freeglut DLL should work. because freeglut *is* a drop-in replacement for the 
old GLUT (modulo support for some obscure input devices). A more detailed 
description of what goes wrong with that simple approach would be helpful...

Cheers,
   S.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of GLUT package

2007-09-03 Thread Martin Lütke

Ronald Guida schrieb:


The first command, "runghc Setup.hs configure", fails, reporting that
it can't find "sh".  Naturally, I'm on a Windows box, so I don't have
the Unix shell on my system.

So now I'm stuck...

* Is there an easy way to work around the absence of "sh"?


Try Cygwin? http://www.cygwin.com/

By the way, its nice to know how to get haskells opengl lib to use 
freeglut. Compile the Glut package from hackage.


I was in the same situation like you and wondered why ghc wont use the 
freeglut.dll. And why, when I renamed freeglut to glut32 a link error 
occured (or was it a runtime error when calling a freeglut specific 
function?). I thought freeglut can be used as a dropin for glut32.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Installation of GLUT package

2007-09-03 Thread Ronald Guida

About a month ago, I asked about how to install freeglut and get GHC
to recognize it.  I was side-tracked; I finally decided to try to get
it working, and I'm just stuck.

I have GHC 6.6.1 and freeglut 2.4.0.  Freeglut successfully compiled
"out of the box" in MS Visual Studio.Net 2003 on my Windows XP box.
GHC won't recognize freeglut; I found out that I need to recompile the
GLUT package to get things working.

Today I downloaded the GLUT package from hackage.haskell.org and
attempted to install it.  The installation blows up.

According to Cabal/How_to_install_a_Cabal_package, I need to download
the package, unzip it, and then run the following three commands.

1. runghc Setup.hs configure
2. runghc Setup.hs build
3. runghc Setup.hs install

The first command, "runghc Setup.hs configure", fails, reporting that
it can't find "sh".  Naturally, I'm on a Windows box, so I don't have
the Unix shell on my system.

So now I'm stuck...

* Is there an easy way to work around the absence of "sh"?

* Is there an easy way to get "sh" on my Windows box?

*  GHC was available pre-compiled for Windows.  Is there an easy
 way to get someone else to compile the GLUT package for me? :-) 

* Is it feasible to walk past a cut and "upgrade" to Linux?  Most
 Windows programs can be replaced by open-source equivalents, but my
 sticky issue is that there's no Linux version of iTunes.

-- Ron

PS, Here's the output of configure.  Do I really need all this stuff
just for the GLUT package?

C:\GLUT\GLUT-2.0>runghc Setup.hs configure
Configuring GLUT-2.0...
configure: Dependency base-any: using base-2.1.1
configure: Dependency OpenGL-any: using OpenGL-2.2.1
configure: Using install prefix: C:\Program Files
configure: Binaries installed in: C:\Program Files\Haskell\bin
configure: Libraries installed in: C:\Program 
Files\Haskell\GLUT-2.0\ghc-6.6.1

configure: Private binaries installed in: C:\Program Files\GLUT-2.0
configure: Data files installed in: C:\Program Files\Common Files\GLUT-2.0
configure: Using compiler: C:\ghc\ghc-6.6.1\bin\ghc.exe
configure: Compiler flavor: GHC
configure: Compiler version: 6.6.1
configure: Using package tool: C:\ghc\ghc-6.6.1\bin\ghc-pkg.exe
configure: Using ar found on system at: C:\ghc\ghc-6.6.1\bin\ar.exe
configure: No haddock found
configure: No pfesetup found
configure: No ranlib found
configure: Using runghc found on system at: C:\ghc\ghc-6.6.1\bin\runghc.exe
configure: No runhugs found
configure: No happy found
configure: No alex found
configure: Using hsc2hs: C:\ghc\ghc-6.6.1\bin\hsc2hs.exe
configure: No c2hs found
configure: No cpphs found
configure: No greencard found
Setup.hs: Cannot find: sh

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe