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
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.
Related
When I ran the command stack build language-plutus-core I received the following error:
-- While building custom Setup.hs for package cryptonite-openssl-0.7 using:
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6
.4.exe --builddir=.stack-work\dist\e626a42b configure --with-ghc=C:\Users...
Process exited with code: ExitFailure 1
Logs have been written to: C:\Projects\2019-08-07-Plutus\plutus-master\.stac
k-work\logs\cryptonite-openssl-0.7.log
Configuring cryptonite-openssl-0.7...
Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.4.exe: Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: eay32, ssl32
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries are already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
If the library files do exist, it may contain errors that are caught by the C compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Anyone any idea how to fix this? Do i need to install eay32, ssl32 separately?
Consider installing these packages using the bundled MSYS in your stack installation. First do stack exec bash to enter MSYS, then use the pacman in that MSYS environment.
The packages from the bundled pacman are from MinGW32, MinGW64 and MSYS2, so most of them (as far as I have used) should be prefixed with mingw-w64-i686- or mingw-w64-x86_64-. See the official documentation for msys2 for detailed information.
Whe i try to install the Haskell package "call-haskell-from-anything" i get the following error messages:
cabal.exe: Missing dependency on a foreign library:
* Missing C library: HSrts-ghc8.0.1
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 'C:\Users\Manfred\AppData\Local\Temp\cabal-tmp-2460\call-haskell-from-anything-1.0.1.0'
cabal: Error: some packages failed to install:
call-haskell-from-anything-1.0.1.0 failed during the configure step. The
exception was:
ExitFailure 1
What is this HSrts-ghc8.0.1 library and where can i find it on a Windows system?
Or do i have to manually install this library in Windows?
Edit 1:
In the meantime i tried the "stack" tool and got a similar error:
[1 of 1] Compiling Main ( C:\Users\Manfred\AppData\Local\Temp\stack4480\call-haskell-from-anything-1.0.1.0\Setup.hs, C:\Users\Manfred\AppData\Local\Temp\stack4480\call-haskell-from-anything-1.0.1.0\.stack-work\dist\2672c1f3\setup\Main.o )
Linking C:\Users\Manfred\AppData\Local\Temp\stack4480\call-haskell-from-anything-1.0.1.0\.stack-work\dist\2672c1f3\setup\setup.exe ...
Configuring call-haskell-from-anything-1.0.1.0...
Determining GHC version: 7.10.3
setup.exe: Missing dependency on a foreign library:
* Missing C library: HSrts-ghc7.10.3
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.
This won't work on Windows (yet).
call-haskell-from-anything seems rely on using a version of GHC that requires -dynamic support. From their cabal file:
ghc-options:
-- For building TemplateHaskell with cabal and -dynamic, we have to disable -dynamic sometimes
-no-hs-main -fPIC -shared -dynamic
Also -fPIC is not a flag that means anything on Windows as windows doesn't use/need Position Independent Code.
HSrts-ghc8.0.1 is referring to the dynamic version of the GHC runtime which is not currently building on Windows due to https://ghc.haskell.org/trac/ghc/ticket/5987
I am trying to get this done by 8.2.1 which should support dynamic compilation again. But for now, sorry, this package won't work.
Dynamic support may not be needed, so you can try unpacking the project and editing the cabal file, removing -fPIC and -dynamic.
I've just installed Mint 17 on my laptop and followed this with haskell platform generic. (I chose generic instead of using apt-get because it was the only way I could get ghc 7.10) When I try:
cabal install cabal-install
I get this error:
Resolving dependencies...
Configuring cabal-install-1.22.6.0...
Failed to install cabal-install-1.22.6.0
Build log ( /home/william/.cabal/logs/cabal-install-1.22.6.0.log ):
cabal: Error: some packages failed to install:
cabal-install-1.22.6.0 failed during the configure step. The exception was:
user error ('/usr/local/bin/ghc' exited with an error:
/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
)
Does anyone know how to fix this ?
update:
Fixed by installing libgmp-dev
[edit] You already found that
sudo apt-get install libgmp-dev
should solve your problem (for Mint - for systems without apt-get you would need to use the resident package manager, and in other apt-get based system there could be variation in package names).
If you run into similar errors in the future, here is the reasoning with which to solve the problem: ld is a linker, essentially linking libraries into a program which is being compiled. -lgmp is the argument supplied to ld, telling it to link in the library gmp. It cannot find this library, so either you need to:
(a) tell it about its location in case you know you have the library (the cabal argument --extra-lib-dirs= is useful in this case), or
(b) install the library (google the library name and your system).
GMP is the GNU MP Bignum library which plays a role in providing the Integer and Fractional types.
I am attempting to install the llvm-general Cabal package on OS X. When I do, I get the following error:
$ cabal install llvm-general
Resolving dependencies...
[1 of 1] Compiling Main ( /var/folders/PP/PP+wAuBcGWuqzt-Iekiipk+++TI/-Tmp-/llvm-general-3.4.4.2-38424/llvm-general-3.4.4.2/Setup.hs, /var/folders/PP/PP+wAuBcGWuqzt-Iekiipk+++TI/-Tmp-/llvm-general-3.4.4.2-38424/llvm-general-3.4.4.2/dist/setup/Main.o )
Linking /var/folders/PP/PP+wAuBcGWuqzt-Iekiipk+++TI/-Tmp-/llvm-general-3.4.4.2-38424/llvm-general-3.4.4.2/dist/setup/setup ...
setup: The program llvm-config version ==3.4.* is required but the version
found at /usr/local/bin/llvm-config is version 3.2
cabal: Error: some packages failed to install:
llvm-general-3.4.4.2 failed during the configure step. The exception was:
ExitFailure 1
What it's doing is running /usr/local/bin/llvm-config; this, I believe, is the version of LLVM installed by the OS X developer tools that I installed a while ago. I do have the current version of LLVM, but it's installed with Homebrew as a local (keg-only) installation. Is there any way I can point cabal to that version of LLVM for the purposes of this installation?
I believe that cabal simply looks in your PATH for llvm-config, so just adjust your path accordingly. Otherwise you can try:
modify the file llvm-general.cabal to reference an absolute path for llvm-config (line 52)
temporarily move aside /usr/local/bin/llvm-config and replace it with the llvm-config for the llvm installation you want to use
For reference, I found llvm-config for version 3.4 at /usr/local/Cellar/llvm34/3.4.2/lib/llvm-3.4/bin/llvm-config on my OSX system.
I'm updating my yesod framework to the latest yesod 1.2 version. I've installed yesod-platform (painfully....had to manually delete old dependency....cabal hell), now I need to install yesod-bin and it should be done. However, after sudo cabal install yesod-bin I'm getting the following error.
Building yesod-bin-1.2.0...
Preprocessing executable 'yesod-ld-wrapper' for yesod-bin-1.2.0...
[1 of 1] Compiling Main ( ghcwrapper.hs, dist/build/yesod-ld-wrapper/yesod-ld-wrapper-tmp/Main.o )
Linking dist/build/yesod-ld-wrapper/yesod-ld-wrapper ...
/usr/bin/ld: cannot find -lHStar-0.4.0.1
/usr/bin/ld: cannot find -lHSoptparse-applicative-0.5.2.1
/usr/bin/ld: cannot find -lHSghc-paths-0.1.0.9
/usr/bin/ld: cannot find -lHSfsnotify-0.0.6
/usr/bin/ld: cannot find -lHShinotify-0.3.5
collect2: ld returned 1 exit status
Failed to install yesod-bin-1.2.0
cabal: Error: some packages failed to install:
yesod-bin-1.2.0 failed during the building phase. The exception was:
ExitFailure 1
According to this, I feel it may have something to do with privileges I'm not sure.
EDIT: So I only found the following two libraries.
/usr/lib/haskell-packages/ghc/lib/tar-0.3.2.0/ghc-7.4.1/libHStar-0.3.2.0.a
/usr/lib/haskell-packages/ghc/lib/ghc-paths-0.1.0.8/ghc-7.4.1/libHSghc-paths-0.1.0.8.a
I'm trying to update libghc-tar-dev to the newest version 0.4.0.1. However, 0.3.2.0 is the newest version on apt-get what are my options?
First, I'd check to see if you have the libraries libHStar, libHSoptparse-applicative, libHSghc-paths, libHSfsnotify and libHShinotify. If you installed the haskell platform using your distro's package manager, I suspect you'll find those libraries in /usr/local/lib/ghc-*.*.*/. For example, you might search for the first library using this command:
sudo find /usr/local/lib -name 'libHStar*'
If you don't have those libraries, then I think you can get them by using your distro's package manager to install the following:
libghc-tar-dev
libghc-optparse-applicative-dev
libghc-ghc-paths-dev
libghc-fsnotify-dev
libghc-hinotify-dev
If you already have those libraries, then you could adapt the fix suggested in your link:
sudo chmod a+r /usr/local/lib/ghc-*/libHS*
UPDATE:
The standard recommendation seems to be that you should always use your linux distro's package manager to install stuff, rather than using the cabal command directly. And if a package you want isn't available yet on your distro, request it. This approach is the safest, because all of the dependencies have been sorted out for you. The disadvantage is that you won't usually have the latest release. I see that there is a yesod package on Ubuntu. I have no idea if it contains yesod-bin (I'm not familiar with yesod), but if it does, that's the safest approach. The downside is that you will probably have to wipe out your cabal library and start from scratch (re-install haskell-platform, then yesod).
Another option, which seems to be the road you're on, is to use your package manager to install the haskell-platform, but after that use the cabal command to install any haskell-y stuff. You'll still use your package manager to install things that can't be installed using cabal (e.g., non-haskell stuff). If you do this, you can avoid a lot of cabal hell by never running cabal as root, and never letting your package manager do anything that can be done using cabal. The main disadvantage of this approach is that you have to deal with library dependencies yourself, as you've discovered. If you want to continue down this road, you might be able to get everything you need by switching to some development/test build for Ubuntu. Or you may have to get the correct versions of the libraries you need and manually install them.