Issues installing Haskell package with C dependencies (glpk)

107 Views Asked by At

The Haskell package Numeric.LinearProgramming depends on the C library glpk. Upon attempted installation on Ubuntu 18.04 with command cabal install hmatrix-glpk-0.19.0.0 the following error appears:

Resolving dependencies...
Notice: installing into a sandbox located at /home/owen/.cabal-sandbox
Configuring hmatrix-glpk-0.19.0.0...
Failed to install hmatrix-glpk-0.19.0.0
Build log ( /home/owen/.cabal-sandbox/logs/hmatrix-glpk-0.19.0.0.log ):
cabal: Entering directory '/tmp/cabal-tmp-7470/hmatrix-glpk-0.19.0.0'
Configuring hmatrix-glpk-0.19.0.0...
cabal: 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 '/tmp/cabal-tmp-7470/hmatrix-glpk-0.19.0.0'
cabal: Error: some packages failed to install:
hmatrix-glpk-0.19.0.0 failed during the configure step. The exception was:
ExitFailure 1

I have glpk-utils installed in the standard spot (by APT) /usr/share/doc/glpk-utils/, but as recommended I tried adding the --extra.../path to glpk-utils tags but it failed with same message.

What could be the problem here? Is glpk-utils the correct package installation? Is it not visible to Cabal? Something else?

1

There are 1 best solutions below

0
On

You need to install libglpk-dev package.

For the difference between libglpk (which is required by glpk-utils) and libglpk-dev, please refer to https://askubuntu.com/questions/1008912/whats-the-difference-between-dev-package-and-ordinary-package, for example. Usually, Haskell FFI requires -dev packages as said in the error message.