简体   繁体   中英

Installing GLUT fails due to missing foreign library - ghc7.8

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM