wxHaskell fails because it depends on wx_macu-2.8 - haskell

I install wxWidgets with macports then ran the command: sudo cabal install wx which output included:
/bin/sh: wxdirect: command not found
/bin/sh: wxdirect: command not found
/bin/sh: wxdirect: command not found
/bin/sh: wxdirect: command not found
Configuring wxcore-0.12.1.6...
setup: Missing dependency on a foreign library:
* Missing C library: wx_macu-2.8
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: Error: some packages failed to install:
wx-0.12.1.6 depends on wxcore-0.12.1.6 which failed to install.
wxcore-0.12.1.6 failed during the configure step. The exception was:
ExitFailure 1
I got the same error when I used this command: sudo cabal install wx --extra-include-dirs=/opt/local --extra-lib-dirs=/opt/local. How can I install wx_macu-2.8, or do what I need to do to fix this problem?

This is saying that you are missing a C library, not a Haskell library. Cabal can't install arbitrary C libraries.
Check the package manager for your distribution to make sure you have everything to do with wxWidgets-2.8, including any developer packages.

Related

Cabal install (Cabal cabal-install) fails due to missing zlib library

I want to install Cabal 3.4.0.0 on Ubuntu 20.04.
$ sudo apt install cabal-install
$ cabal --version
cabal-install version 2.4.0.0
$ sudo cabal update
$ sudo cabal install Cabal cabal-install
...
Starting zlib-0.6.2.3
Failed to install zlib-0.6.2.3
Build log ( /root/.cabal/logs/ghc-8.6.5/zlib-0.6.2.3-93Wbo8gIIzI9bg4p2MsNUF.log ):
cabal: Entering directory '/tmp/cabal-tmp-126381/zlib-0.6.2.3'
Configuring zlib-0.6.2.3...
cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: zlib.h
* Missing (or bad) C library: z
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.If the
library file does 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.
If the header file does 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.
...
cabal: Error: some packages failed to install:
cabal-install-3.4.0.0-3glzV3hM64DLoOfz3dHKsn depends on cabal-install-3.4.0.0
which failed to install.
hackage-security-0.6.0.1-KiAyVYLxooJAP3ckeQHnBD depends on
hackage-security-0.6.0.1 which failed to install.
zlib-0.6.2.3-93Wbo8gIIzI9bg4p2MsNUF failed during the configure step. The
exception was:
ExitFailure 1
The error says:
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version).
How can I install this package on Ubuntu 20.04?
You aim to install the cabal-install package. This package has a dependency that here produces a problem: the zlib package.
This zlib package is essentially a thin wrapper around the zlib C library [wikipedia]. As the error says however, you did not install the zlib library, or at least not its package where one can develop with the zlib library.
We can install this by installing the libghc-zlib-dev software package, for example with:
sudo apt-get install libghc-zlib-dev
If we inspect the package details on Debian, we see that essentially this is a package that will install the zlib1g-dev package, the package to develop software with the zlib library. We can thus decide to install libghc-zlib-dev, or zlib1g-dev with:
sudo apt-get install zlib1g-dev
Nixos Users append pkgs.haskellPackages.zlib to environment.systemPackages

Haskell cabal install wx: missing C library wx_gtk2u_webview-3.0

I am trying to install wx by cabal install wx
Configuring wxc to build against wxWidgets 3.0
setup: Missing dependency on a foreign library:
* Missing C library: wx_gtk2u_webview-3.0
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: Error: some packages failed to install :
wx-0.92.0.0 depends on wxc-0.92.0.0 which failed to install.
wxc-0.92.0.0 failed during the configure step. The exception was:
ExitFailure 1
wxcore-0.92.0.0 depends on wxc-0.92.0.0 which failed to install.
but I have following files in /usr/lib :
/usr/lib/libwx_gtk2u_webview-3.0.so
/usr/lib/libwx_gtk2u_webview-3.0.so.0
/usr/lib/libwx_gtk2u_webview-3.0.so.0.2.0
I have also tried cabal install --extra-lib-dirs=/usr/lib/ wx but to no avail.
I have also tried all the suggestions in cabal install wx Missing C library
I am on archlinux and I have both wxgtk-3.0 and wxgtk-2.8 multilib and normal versions. I also tried reinstalling them.
I just ran into the same problem on Arch; when I tried running cabal with --verbose=3, it looked like libwx_gtk2u_webview-3.0 was present, but it was complaining about libwebkitgtk-1.0 being missing. After I installed the webkitgtk2 package, which provides libwebkitgtk-1.0, wxHaskell installed with no problems.
Try "sudo apt-get install libwxgtk-webview3.0-dev". It worked for me.

Can't install sdl2 via cabal

I am trying to install helm. When I try to install it, however I get this error:
$ cabal install helm
Resolving dependencies...
Configuring sdl2-1.1.0...
cabal: The pkg-config package 'sdl2' version >=2.0.3 is required but it could
not be found.
Failed to install sdl2-1.1.0
cabal: Error: some packages failed to install:
helm-0.6.1 depends on sdl2-1.1.0 which failed to install.
sdl2-1.1.0 failed during the configure step. The exception was:
ExitFailure 1
When I go to install sdl2 by itself, I get a similar message.
$ cabal install sdl2
Resolving dependencies...
Configuring sdl2-1.1.0...
cabal: The pkg-config package 'sdl2' version >=2.0.3 is required but it could
not be found.
Failed to install sdl2-1.1.0
cabal: Error: some packages failed to install:
sdl2-1.1.0 failed during the configure step. The exception was:
ExitFailure 1
I don't understand. According to Hackage, sdl2 is at version 1.1, but installing it requires version 2.0.3? I've tried this in and out of a sandbox. Results of ghc-pkg list are here if you think they're relevant: http://pastebin.com/tFrsfPFe
I'm on Ubuntu btw.
Help?
Another thing which could happen (happened to me) for other installs is that the PKG_CONFIG_PATH variable might not point to the package config file (sdl2.pc, for me in the /usr/local/lib/pkgconfig directory). pkg-config uses some default directories ('/usr/lib/pkgconfig' and '/usr/share/pkgconfig'), but if the sdl.pc file isn't in one of these, you'll have to specify the directory in the environment variable. You can check this with echo $PKG_CONFIG_PATH
If it turns out you need to set the variable, just use export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig (or to whatever directory your sdl2.pc file lives in)
I ran into the same problem, and I just want to add my solution here for the record. The native sdl2 libraries need to be installed first by following the directions here: https://github.com/haskell-game/sdl2#building

installing text-icu on Mac OSX with cabal

I want to try unicode with haskell, and the Data.Text docs say I need text-icu. This is what I tried:
Mac OS X 10.6.8
~/haskell_programs$ cabal update
Downloading the latest package list from hackage.haskell.org
~/haskell_programs$ cabal install text-icu
Resolving dependencies...
Downloading text-icu-0.6.3.5...
Configuring text-icu-0.6.3.5...
cabal: Missing dependencies on foreign libraries:
* Missing C libraries: icui18n, icudata, icuuc
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.
Failed to install text-icu-0.6.3.5
cabal: Error: some packages failed to install:
text-icu-0.6.3.5 failed during the configure step. The exception was:
ExitFailure 1
I found a post by a Windows user who had the same problem. Do I really need to go out and install those C libraries? Or are they 'misplaced' somewhere on my system?
Thanks.
If you have are using Homebrew, then this is the command that I use:
DYLD_LIBRARY_PATH=/usr/local/opt/icu4c/lib \
cabal install text-icu \
--extra-include-dirs=/usr/local/opt/icu4c/include \
--extra-lib-dirs=/usr/local/opt/icu4c/lib

Can't Install hmatrix on my Ubuntu Linux machine

I am trying to install hmatrix on my Ubuntu Linux machine (don't know if this is necessary, but it may help) and no matter what I do it will not work.
I run cabal install hmatrix and get this:
Configuring hmatrix-0.13.1.0...
Checking foreign libraries... FAIL
*** Sorry, I can't link GSL.
*** Please make sure that the appropriate -dev packages are installed.
*** You can also specify the required libraries using
*** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc.
setup: Package hmatrix-0.13.1.0 can't be built on this system.
cabal: Error: some packages failed to install:
hmatrix-0.13.1.0 failed during the building phase. The exception was:
ExitFailure 1
Apparently the ExitFailure 1 thing is a leftover from the original program.
When I run cabal configure I get
Warning: 'hs-source-dirs: lib' directory does not exist.
Checking foreign libraries... FAIL
*** Sorry, I can't link GSL.
*** Please make sure that the appropriate -dev packages are installed.
*** You can also specify the required libraries using
*** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc.
Any help would be greatly appreciated and thank you for reading.
You have to install the C libraries, something like libgsl-dev (or -devel), and libgsl itself, but that should be pulled in by the dev package. hmatrix is a binding to a C library, so you need that installed to be able to install hmatrix.
On my box, ghc-pkg describe hmatrix lists
extra-libraries: gsl lapack gslcblas
I'm not sure all of them are actually required for building hmatrix, but it wouldn't harm to also install the dev packages for lapack and BLAS (which may be something else than gslcblas on Ubuntu).
On Ubuntu some of the required libraries can be loaded with apt-get command. Try this,
sudo apt-get install libblas-dev libatlas-dev liblapack-dev
Referring to this file installation on Ubuntu is done using:
sudo apt-get install libgsl0-dev liblapack-dev
cabal install hmatrix

Resources