I have been trying to install the tensorflow/haskell package on my Windows machine.
However, both while installing with stack and cabal, I keep running into this error:
Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe: Missing dependency on a foreign
library:
* Missing C library: tensorflow
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.
According to the Tensorflow website: https://www.tensorflow.org/install/install_c
, the C package for Tensorflow only runs on Unix machines. I am not sure if this is a dead end or if there is some workaround.
I am not experienced with linking libraries or with cabal, and would appreciate some assistance.
Using Cabal, I've included the following .cabal file in my directory:
cabal-version: >= 1.2
Executable hax
Includes: c_api.h
Extra-libraries: tensorflow
but I still receive the errors: cabal.exe: Missing dependency on a foreign library: * Missing C library: tensorflow The exception was: user error (Using 'build-type: Custom' but there is no Setup.hs or Setup.lhs script.)
You write "According to the Tensorflow website: https://www.tensorflow.org/install/install_c , the C package for Tensorflow only runs on Unix machines. I am not sure if this is a dead end or if there is some workaround."
Indeed, if you don't have the tensorflow C package installed on your machine -- because it won't run on it, then you can't find it to bind to it.
There is no work around for that.
Related
I just installed Haskell platform core from the tar ball on my Antergos install and when i try to run ghc i get an error
`/usr/local/haskell/ghc-8.4.3-x86_64/lib/ghc-8.4.3/bin/ghc: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory`
not sure if this is something i can resolve or something that is an issue with haskell platform.
The ghc distributed with the platform links against libtinfo.so.5 and apparently your system doesn't have it. Depending on the details of your distro, you might be able to install the compat package for this, or use the advice in https://forums.opensuse.org/showthread.php/446927-missing-library-libtinfo-so-5 or https://github.com/Valloric/YouCompleteMe/issues/778
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.
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 have decided to try to install gtk2hs on my Windows 8 (64 bit) machine. I am relying on the lastest Haskell Platform distribution.
So, I go on the wiki, and follow the instructions. I get gtk+ 32-bit distribution, version 2.24, in the all in one bundle. I unpack it correclty, set up PATH to point to gtk/bin, and create INCLUDE and LIB variables to point respectively to gtk/include and gtk/lib (this step does not seem necessary, but it can't hurt!)
I then verify all is in order by invoking
pkg-config --modversion gtk+-2.0
and the terminal happly chirps back
2.24.10
Great!
Then, I run cabal install
gtk2hs-buildtools
and that also goes well.
But then, when I run cabal install gtk, it complains that glib fails to install, because it can't find some C dependencies. I try to isolate the problem by running
cabal install glib
and get the following:
C:\Users\Federico>cabal install glib
Resolving dependencies...
Configuring glib-0.13.1.0...
Failed to install glib-0.13.1.0
Last 10 lines of the build log ( C:\Users\Federico\AppData\Roaming\cabal\logs\gl
ib-0.13.1.0.log ):
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist\setup-wrapper\Gtk2HsS
etup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist\setup-wrapper\Main.o )
Linking dist/setup-wrapper\setup.exe ...
Configuring glib-0.13.1.0...
setup.exe: Missing dependencies on foreign libraries:
* Missing C libraries: gobject-2.0, gthread-2.0, glib-2.0, intl
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.
cabal: Error: some packages failed to install:
glib-0.13.1.0 failed during the configure step. The exception was:
ExitFailure 1
But this is utter crap! I KNOW the libraries are there. I can see them, in the gtk/bin folder! I re-check my path, and all is good. They are visible, in path. so is include, and lib. All of it. And yet, cabal complains it can't find them.
But this isn't the scariest bit yet...I download the 64-bit of the library, version 2.16...simply swap the two gtk folders...and now, cabal happly builds the whole thing! Of course, it's unsuable, because ghc on the plaftorm is 32-bit and the libraries are 64-bit, so ghc fails to link against it...but at least cabal was pleased.
I then remove glib, cairo, pango, gtk etc, and go about trying installing again, 2.16, 32-bit. And surely, cabal complains about C dependencies missing.
At this point, befuddled by this kafkian situation, I turn to the wisdom of stack overflow!
Is cabal trolling me? Are the error messages misleading? Or am I missing something obvious?
Thanks to all for the help!
If you are using 64 bit version of GHC, you want to use 64 bit version of gtk as well.
You can download it on this link. Scroll down a bit and download 2.x (not 3.x) all in one bundle, don't download 2.16:
http://www.gtk.org/download/win64.php
Above is no longer an option. You can try installing MSYS and than using MSYS console with pacman package manager to install gtk dev library on windows (I haven't tried it yet though). This pretty much sucks in my opinion.
I am trying to cabal install yesod on my Windows machine. I have a relatively fresh install of the Haskell Platform. The cabal install failed, reporting that I need the sqlite3 C library in order to install "persistent", a package which Yesod relies upon.
cabal: Missing dependency on a foreign library:
* Missing C library: sqlite3
So I went to http://www.sqlite.org/download.html and grabbed both the C source and the precompiled binary. I tried using both, to no avail:
cabal install persistent --extra-lib-dirs=C:\Path\To\C\Source\Files
cabal install persistent --extra-lib-dirs=C:\Path\To\Binary
In both cases, I got the same result: it didn't work. :( What can I do to give cabal the C library it needs? (sqlite3 in this case)
So, facepalm. I didn't need the source, I didn't need the exe. I needed the dll.
Under the "precompiled binaries for Windows" section of the website mentioned in my question, I downloaded and extracted the zip file with sqlite3.def and sqlite.dll. Then I used
cabal install persistent --extra-lib-dirs=C:\Path\To\DllAndDef
The installation appears to have completed successfully. Afterwards, I did a cabal install yesod, which also appears to have completed successfully.
I suppose if I had put the dll somewhere magical, then I wouldn't have had to use the --extra-lib-dirs= option.