2

I tried cabal install GLUT which gave the following:

Setup: Missing dependency on a foreign library:
* Missing C library: glut32
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.

So I thought, ok, lets get the sources and point cabal to the directories. I first tried freeglut and then the following

cabal install GLUT --extra-include-dirs="<path to freeglut>\include" 
                   --extra-lib-dirs="<path to freeglut>\src"

Same thing, so I thought maybe it doesn't work with freeglut, and got glut:

cabal install GLUT --extra-include-dirs="<path to glut>\include" 
                   --extra-lib-dirs="<path to glut>\lib"

When this doesn't work, I try to download the source and cabal install inside the directory, then runghc Setup configure. Then thinking that there is some parse error of the paths, I try every possible way of writing a file path known to man; quotes, no quotes, backslashes, double backslashes, forward slashes, and every combination of the above. I even placed all the files on my PATH in hopes it would find them. All other options exhausted, I proceeded to sacrifice a goat to satan, but still no dice.

The question is, what do I have to do to convince ghc to find this library? (this is windows 7)

user2407038
  • 14,400
  • 3
  • 29
  • 42
  • 1
    Most likely, you need to install a binary version of glut/freeglut, then point `--extra-lib-dirs` to the path where `glut32.dll` is located. – John L Apr 25 '14 at 07:17
  • @JohnL `glut32.dll` is on `PATH` so it should find it but I tried it anyways and the result is as expected. – user2407038 Apr 25 '14 at 10:22

1 Answers1

1

You need to make the libglut32.a import library accessible to the compiler (see this answer for information about what import libraries are). Just copy it under $GHCDIR/mingw/lib. Alternatively, try the Haskell Platform installer, which ships with a pre-compiled version of the GLUT bindings.

Community
  • 1
  • 1
Mikhail Glushenkov
  • 14,928
  • 3
  • 52
  • 65