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?
You need to install
libglpk-devpackage.For the difference between
libglpk(which is required byglpk-utils) andlibglpk-dev, please refer to https://askubuntu.com/questions/1008912/whats-the-difference-between-dev-package-and-ordinary-package, for example. Usually, Haskell FFI requires-devpackages as said in the error message.