I finally got round to trying cabal-install with OpenGL/GLUT,
using a freshly built ghc head, a cygwin bash, and

> http://haskell.org/~duncan/cabal/cabal.exe

   cabal-install version 0.6.0
   using version 1.6.0.1 of the Cabal library

> Yes, building it requires mingw/msys, but with it cabal install opengl
> really does work (I've tried it).

   cabal.exe opengl glut

The first oddity was in the dependency resolution phase, where cabal.exe
insists on installing array-0.2.0.0 and containers-0.2.0.0, which are already
installed. Ignoring that, the build went through without any apparent hitch.
Here is the relevant part of the build log:

   package: GLUT-2.1.1.2
   os: windows
   arch: i386
   compiler: ghc-6.11.20081202
   client: cabal-install-0.6.0
   flags: split-base
   dependencies: OpenGL-2.2.1.1 array-0.2.0.0 base-3.0.3.0
                 containers-0.2.0.0
   install-outcome: InstallOk
   docs-outcome: NotTried
   tests-outcome: NotTried

   package: OpenGL-2.2.1.1
   os: windows
   arch: i386
   compiler: ghc-6.11.20081202
   client: cabal-install-0.6.0
   flags:
   dependencies: base-3.0.3.0
   install-outcome: InstallOk
   docs-outcome: NotTried
   tests-outcome: NotTried

   package: array-0.2.0.0
   os: windows
   arch: i386
   compiler: ghc-6.11.20081202
   client: cabal-install-0.6.0
   flags:
   dependencies: base-4.0.0.0 syb-0.1.0.0
   install-outcome: InstallOk
   docs-outcome: NotTried
   tests-outcome: NotTried

   package: containers-0.2.0.0
   os: windows
   arch: i386
   compiler: ghc-6.11.20081202
   client: cabal-install-0.6.0
   flags:
   dependencies: array-0.2.0.0 base-4.0.0.0
   install-outcome: InstallOk
   docs-outcome: NotTried
   tests-outcome: NotTried

But when I actually try to build anything using (yes, I know the explicit
package flags aren't needed with --make)

   ghc --make -package OpenGL -package GLUT something.hs

I get nothing but undefined references in the linking phase.

   C:\Program 
Files\Haskell\GLUT-2.1.1.2\ghc-6.11.20081202/libHSGLUT-2.1.1.2.a(Window.o):fake:
(.text+0x15): undefined reference to `glutWarpPointer'
C:\Program Files\Haskell\GLUT-2.1.1.2\ghc-6.11.20081202/libHSGLUT-2.1.1.2.a(Window.o):fake:(.text+0x3d): undefined reference to `glutReshapeWindow' C:\Program Files\Haskell\GLUT-2.1.1.2\ghc-6.11.20081202/libHSGLUT-2.1.1.2.a(Window.o):fake:(.text+0x65): undefined reference to `glutPositionWindow'
   ..

The problem is that this places an additional barrier on distribution:
Haskell OpenGL authors cannot simply distribute their Haskell code,
because many other Haskellers will not be able to get it to work:

For the rest of the issues I think the proper solution is the platform
installer which would include cabal.exe and a pre-built OpenGL.

We could probably do better for packages that need mingw. Most of them
record this information in the build-type: Configure, so perhaps
cabal.exe should check if sh.exe is present before trying to build
packages that need it. If that sounds sensible then lets file a ticket
so we don't forget.

'build-type: Configure' just means that configure is needed, but says
nothing about whether that is the MSys/Cygwin/.. variant of the
toolchain, or which version. That would be okay if the variant/version
didn't matter, but that is rarely the case.

Why not have a shallow facade cabal-package for the native packages/
tools? Then cabal packages could depend on precise versions of those
facade packages for windows builds, and users would know exactly
what they need (and whether they have it, if the test for MSys/configure
is in the msys-configure package, or where to get it, if that is documented
in the facade packages; the same trick should work for other tool
dependencies, such as happy/alex/..; possibly even for non-haskell
library dependencies for API FFI bindings: depend on the msys-configure
package, run configure to see whether library is installed, register outcome
as a cabal facade package with how-to-get-it information).

Btw, is the format for the cabal config file documented somewhere?
I though I had set documentation to True.

Claus


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

Reply via email to