Fandom_Lover
Fandom_Lover

Reputation: 71

Unable to Install glpk-hs

I've installed the Haskell Compiler and glpk-hs using the instructions here. Further, I've used cabal install glpk-hs to install required files in an attempt to compile a Haskell Program.

However, the cabal installation of glpk is not working. The following message keeps popping up:

Resolving dependencies...

Configuring glpk-hs-0.5...

Failed to install glpk-hs-0.5

Build log :

cabal: Entering directory '/var/folders/cr/9f1ltj7d4b31hmkfn03hjl_r0000gn/T/cabal-tmp-12521/glpk-hs-0.5'

Configuring glpk-hs-0.5...

cabal.real: Missing dependency on a foreign library:

  • Missing C library: glpk

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. cabal:

Leaving directory '/var/folders/cr/9f1ltj7d4b31hmkfn03hjl_r0000gn/T/cabal-tmp-12521/glpk-hs-0.5'

cabal: Error: some packages failed to install: glpk-hs-0.5 failed during the configure step. The exception was:

ExitFailure 1

As above, I have tried both installing glpk in a nonstandard location and the standard location, but in all cases, has been unable to find the glpk.

The glpsol solver, which uses GLPK is installed though, as it shows the version of which it is currently running: GLPSOL: GLPK LP/MIP Solver, v4.62

Upvotes: 1

Views: 295

Answers (1)

Fandom_Lover
Fandom_Lover

Reputation: 71

Figured it out! hmatrix-glpk had the extra directories for OS X in the .cabal file:

if os(OSX)
     extra-lib-dirs: /usr/lib
     extra-lib-dirs: /opt/local/lib/
     include-dirs: /opt/local/include/
     extra-lib-dirs: /usr/local/lib/
     include-dirs: /usr/local/include/
     if arch(i386)
         cc-options: -arch i386

Copying this into the glpk-hs.cabal allows the installation to work.

Upvotes: 1

Related Questions