Installing gtk2hs - haskell

I've installed gtk2hs-buildtools with no problem, but here's the output when I try to install gtk using 'cabal install gtk':
[gautam#gautam ~]$ cabal install gtk
Resolving dependencies...
[1 of 2] Compiling SetupWrapper ( /tmp/cairo-0.12.213784/cairo-0.12.2/SetupWrapper.hs, /tmp/cairo-0.12.213784/cairo-0.12.2/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /tmp/cairo-0.12.213784/cairo-0.12.2/Setup.hs, /tmp/cairo-0.12.213784/cairo-0.12.2/dist/setup/Main.o )
Linking /tmp/cairo-0.12.213784/cairo-0.12.2/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Cannot find gtk2hsC2hs
Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).
[1 of 2] Compiling SetupWrapper ( /tmp/glib-0.12.213784/glib-0.12.2/SetupWrapper.hs, /tmp/glib-0.12.213784/glib-0.12.2/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /tmp/glib-0.12.213784/glib-0.12.2/Setup.hs, /tmp/glib-0.12.213784/glib-0.12.2/dist/setup/Main.o )
Linking /tmp/glib-0.12.213784/glib-0.12.2/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Cannot find gtk2hsC2hs
Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).
cabal: Error: some packages failed to install:
cairo-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
gio-0.12.2 depends on glib-0.12.2 which failed to install.
glib-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
gtk-0.12.2 depends on glib-0.12.2 which failed to install.
pango-0.12.2 depends on glib-0.12.2 which failed to install.
[gautam#gautam ~]$
This problem occurs on both my Mac and in my Fedora VM. Does anybody know how to fix this? Thanks!

You need to add the path in which the Gtk2Hs build tools are stored to your $PATH environment variable, so that the build process can find them. On Linux, it's $HOME/.cabal/bin. On OS X, it's $HOME/Library/Haskell/bin (although that might just be if you're using the Haskell Platform — if that doesn't work, try $HOME/.cabal/bin).
To add a directory to your $PATH, run export PATH=directory:$PATH. You should probably add this to your shell's startup file (it depends on your shell and OS — probably either ~/.bashrc, ~/.profile or ~/.bash_profile). (You'll need to do so if you want to run any programs you install with cabal directly, anyway.)

Related

How can I fix wrong .cabal file of dependent package in Haskell Stack?

I use Haskell Stack in Windows 10
When I try to install gtk as dependency of my own package, I got following messages.
glib-0.13.2.2: configure
glib-0.13.2.2: build
Progress: 1/5
-- While building package glib-0.13.2.2 using:
C:\Users\junyoung\AppData\Local\Temp\stack6012\glib-0.13.2.2\.stack-work\dist\2672c1f3\setup\setup --builddir=.stack-work\dist\2672c1f3 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: C:\Users\junyoung\Documents\HaskellProject\StackProject\Hotepad\.stack-work\logs\glib-0.13.2.2.log
[1 of 2] Compiling SetupWrapper ( SetupWrapper.hs, C:\Users\junyoung\AppData\Local\Temp\stack6012\glib-0.13.2.2\.stack-work\dist\2672c1f3\setup\SetupWrapper.o )
[2 of 2] Compiling Main ( C:\Users\junyoung\AppData\Local\Temp\stack6012\glib-0.13.2.2\Setup.hs, C:\Users\junyoung\AppData\Local\Temp\stack6012\glib-0.13.2.2\.stack-work\dist\2672c1f3\setup\Main.o )
Linking C:\Users\junyoung\AppData\Local\Temp\stack6012\glib-0.13.2.2\.stack-work\dist\2672c1f3\setup\setup.exe ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist\setup-wrapper\Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist\setup-wrapper\Main.o )
Linking dist/setup-wrapper\setup.exe ...
Configuring glib-0.13.2.2...
Building glib-0.13.2.2...
Preprocessing library glib-0.13.2.2...
.stack-work\dist\2672c1f3\build\System\Glib\StoreValue_hsc_utils.o:StoreValue_hsc_utils.c:(.text+0x0): multiple definition of `__debugbreak'
.stack-work\dist\2672c1f3\build\System\Glib\StoreValue_hsc_make.o:StoreValue_hsc_make.c:(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
linking .stack-work\dist\2672c1f3\build\System\Glib\StoreValue_hsc_make.o failed (exit code 1)
command was: C:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\mingw\bin\gcc.exe .stack-work\dist\2672c1f3\build\System\Glib\StoreValue_hsc_make.o .stack-work\dist\2672c1f3\build\System\Glib\StoreValue_hsc_utils.o -o .stack-work\dist\2672c1f3\build\System\Glib\StoreValue_hsc_make.exe -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib -LC:/msys64/mingw64/lib -lgobject-2.0 -lglib-2.0 -lintl -LC:\Users\junyoung\AppData\Roaming\stack\snapshots\f21484d8\lib\x86_64-windows-ghc-7.10.3\utf8-string-1.0.1.1-L8eKHa7Iv9q7FVKUYW6u4b -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib -LC:\Users\junyoung\AppData\Roaming\stack\snapshots\64a043b0\lib\x86_64-windows-ghc-7.10.3\text-1.2.2.1-HmqVQnZSpjaC156ABqPhne -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\binar_3uXFWMoAGBg0xKP9MHKRwi -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\conta_2C3ZI8RgPO2LBMidXKTvIU -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\bytes_6VWy06pWzJq9evDvK2d4w6 -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\deeps_6vMKxt5sPFR0XsbRWvvq59 -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\array_67iodizgJQIIxYVTp4emlA -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\base_HQfYBxpPvuw8OunzQu6JGM -lwsock32 -luser32 -lshell32 -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\integ_2aU3IZNMF9a7mQ0OzsZ0dS -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\ghcpr_8TmvWUcS1U1IKHT0levwg3 -LC:\Users\junyoung\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib/rts -lm -lwsock32 -lgdi32 -lwinmm
I found that this messages is because of glib.cabal files bug at glib-0.13.2.2, so when I try to install glib separately, I edit glib.cabal (remove -D___attribute__(A)= option on cpp) and install clearly.
However, when I try to install it using stack, stack install gtk command always takes Hackage one instead of installed glib package.
For short, therefore, my question is, how can I using separately installed glib? Or, is there any way to modify packages .cabal file while installing it, using options or whatever?
Stack lets you use a dependency from a local directory, or a github repo. So feel free to fork the project, do the fixes, maybe even do a PR, and then put this into your stack.yaml under "packages" section:
- location:
git: https://github.com/user/repo
commit: a1b3559090e9c75ce1d46969085fe4f918b2fa82

Can't install 'ihaskell-diagrams' using Cabal

When I try to
cabal install ihaskell-diagrams
I get the error
The pkg-config package 'glib-2.0' is required but it could not be
found.
What is glib and how do I install it so that it is available for Cabal?
Resolving dependencies...
Configuring cairo-0.13.1.0...
Configuring glib-0.13.2.1...
Failed to install cairo-0.13.1.0
Build log ( /Users/Rax/.cabal/logs/cairo-0.13.1.0.log ):
[1 of 2] Compiling SetupWrapper ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/SetupWrapper.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/setup.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/Main.o )
Linking /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring cairo-0.13.1.0...
setup: The pkg-config package 'cairo' version >=1.2.0 is required but it could
not be found.
Failed to install glib-0.13.2.1
Build log ( /Users/Rax/.cabal/logs/glib-0.13.2.1.log ):
[1 of 2] Compiling SetupWrapper ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/SetupWrapper.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/setup.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/Main.o )
Linking /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glib-0.13.2.1...
setup: The pkg-config package 'glib-2.0' is required but it could not be
found.
cabal: Error: some packages failed to install:
cairo-0.13.1.0 failed during the configure step. The exception was:
ExitFailure 1
diagrams-cairo-1.3.0.5 depends on glib-0.13.2.1 which failed to install.
glib-0.13.2.1 failed during the configure step. The exception was:
ExitFailure 1
ihaskell-diagrams-0.3.1.0 depends on glib-0.13.2.1 which failed to install.
pango-0.13.1.0 depends on glib-0.13.2.1 which failed to install.
The confusion here results from the perhaps unclear error message: the missing components are not Cabal packages, but libraries that need to be separately installed.
Some of these libraries have their own dependencies, or installing them may reveal additional missing packages, so that the specific requirements on your system my be different; but in general, when you get an error that a "pig-config package" is missing, you will need to install it with your package manager (not Cabal).
For example,
brew install glib
brew install cairo
brew install pango
work for me and allow me to
cabal install ihaskell-diagrams
without further errors.

Windows 8 ghc-mod installation fails

I'm trying to work on Haskell in IntelliJ IDEA on Windows 8.
I installed the latest Haskell plugin, and found that it requires ghc.exe, cabal.exe and ghc-mod.exe prepared. Haskell Platform (x64) originally contains ghc.exe and cabal.exe, so what I need in order to make the plugin work is ghc-mod.exe.
Just as many guides say, I tried installing it through cabal like this:
cabal install ghc-mod
It failed installing haskell-src-exts in the middle of the process, so I installed happy and tried the same command again. Then it succeeded to install src-exts, yet not ghc-mod. Cabal produced this error log:
Building ghc-mod-0.3.0...
Preprocessing executable 'ghc-mod' for ghc-mod-0.3.0...
[1 of 6] Compiling Param ( Param.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\Param.o )
[2 of 6] Compiling Lang ( Lang.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\Lang.o )
[3 of 6] Compiling List ( List.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\List.o )
[4 of 6] Compiling Check ( Check.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\Check.o )
[5 of 6] Compiling Browse ( Browse.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\Browse.o )
Browse.hs:41:72:
Not in scope: data constructor `ExplicitForall'
Perhaps you meant `ExplicitForAll' (imported from Language.Haskell.Exts.Extension)
This doesn't make sense to me at all. What can I do?

GUI programming in Haskell - installation problems on Ubuntu

is there a GUI package that is still up-to-date?
I tried installing both wxHaskell and gtk2hs today and both fail on dependencies I just cannot solve (wxHaskell cannot find some wxWidget libs and while trying the glade tutorial gtk2hs fails on a missing pkg-config libglade2-0 I installed too).
I guess it's just some problem with me not understanding the linux/cabal/package install things good enough but is there a up-to-date tutorial how to get started (install) some GUI lib for Haskell somewhere around?
Here are the errors:
carsten#Carsten-VirtualBox:~$ cabal install glade
Resolving dependencies...
[1 of 2] Compiling SetupWrapper ( /tmp/glade-0.12.1-12934/glade-0.12.1/SetupWrapper.hs, /tmp/glade-0.12.1-12934/glade-0.12.1/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /tmp/glade-0.12.1-12934/glade-0.12.1/Setup.hs, /tmp/glade-0.12.1-12934/glade-0.12.1/dist/setup/Main.o )
Linking /tmp/glade-0.12.1-12934/glade-0.12.1/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glade-0.12.1...
setup: The pkg-config package libglade-2.0 version >=2.0.0 is required but it
could not be found.
cabal: Error: some packages failed to install:
glade-0.12.1 failed during the configure step. The exception was:
ExitFailure 1
and
carsten#Carsten-VirtualBox:~$ cabal install wxc
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/Setup.hs, /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/dist/setup/Main.o )
Linking /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/dist/setup/setup ...
Configuring wxc-0.90.0.4...
Warning: No config found to match: /usr/bin/wx-config --version=2.9 --version-full
in /usr/lib/x86_64-linux-gnu/wx/config
If you require this configuration, please install the desired
library build. If this is part of an automated configuration
test and no other errors occur, you may safely ignore it.
You may use wx-config --list to see all configs available in
the default prefix.
setup: failed
cabal: Error: some packages failed to install:
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1
This is really frustrating me - maybe someone can help me here - thank you!
I am running 12.04 and everything works fine for me.
Are you sure you have libglade2-dev installed ? That should fix it.
Coming from ArchLinux i had the same problem at first when i didn't know there were separate dev libraries, i don't remember having to do this in arch.

How do I troubleshoot cabal-install errors for the vector-algorithms package, darcs, and others?

$ ghc -V; cabal -V
The Glorious Glasgow Haskell Compilation System, version 7.0.1
cabal-install version 0.8.2
using version 1.8.0.6 of the Cabal library
Here's the error:
$ cabal install vector-algorithms
Resolving dependencies...
Configuring vector-algorithms-0.3.4...
Preprocessing library vector-algorithms-0.3.4...
Building vector-algorithms-0.3.4...
[1 of 9] Compiling Data.Vector.Algorithms.Common ( Data/Vector/Algorithms/Common.hs, dist/build/Data/Vector/Algorithms/Common.o )
[2 of 9] Compiling Data.Vector.Algorithms.Radix ( Data/Vector/Algorithms/Radix.hs, dist/build/Data/Vector/Algorithms/Radix.o )
[3 of 9] Compiling Data.Vector.Algorithms.Search ( Data/Vector/Algorithms/Search.hs, dist/build/Data/Vector/Algorithms/Search.o )
[4 of 9] Compiling Data.Vector.Algorithms.Optimal ( Data/Vector/Algorithms/Optimal.hs, dist/build/Data/Vector/Algorithms/Optimal.o )
[5 of 9] Compiling Data.Vector.Algorithms.Insertion ( Data/Vector/Algorithms/Insertion.hs, dist/build/Data/Vector/Algorithms/Insertion.o )
[6 of 9] Compiling Data.Vector.Algorithms.TriHeap ( Data/Vector/Algorithms/TriHeap.hs, dist/build/Data/Vector/Algorithms/TriHeap.o )
[7 of 9] Compiling Data.Vector.Algorithms.Intro ( Data/Vector/Algorithms/Intro.hs, dist/build/Data/Vector/Algorithms/Intro.o )
[8 of 9] Compiling Data.Vector.Algorithms.Merge ( Data/Vector/Algorithms/Merge.hs, dist/build/Data/Vector/Algorithms/Merge.o )
[9 of 9] Compiling Data.Vector.Algorithms.Combinators ( Data/Vector/Algorithms/Combinators.hs, dist/build/Data/Vector/Algorithms/Combinators.o )
Data/Vector/Algorithms/Combinators.hs:36:23:
Couldn't match type `forall s1. ST s1 (Mutable v s1 e)'
with `ST s (mv s e)'
In the second argument of `(.)', namely `N.New'
In the expression: new . N.New
In the expression:
(new . N.New)
(M.unstream (stream v) >>= \ arr -> algo arr >> return arr)
cabal: Error: some packages failed to install:
vector-algorithms-0.3.4 failed during the building phase. The exception was:
ExitFailure 1
I also noticed that when I installed cabal-install it installed process-1.0.1.4, random-1.0.0.3, Cabal-1.8.0.6,
and the time-1.2.0.3 packages which were already present in the global package database.
For example, trying to install darcs and other packages I receive the following:
Resolving dependencies...
<command line>: cannot satisfy -package Cabal-1.10.0.0:
Cabal-1.10.0.0-30b3f082077a2793c432ea426276c8f9 is unusable due to missing or recursive dependencies:
process-1.0.1.4-b476e45706840d55749b12ebe18dc835
(use -v for more information)
cabal: Error: some packages failed to install:
I tried ghc-pkg unregister for all the dups, but that didn't help.
I also tried ghc-pkg check and that doesn't return anything, ever.
I tried starting over, removing all the local databases including $HOME/.cabal/, then reinstalling cabal-install and this is where I'm currently at.
This is the result after removing everything, and reinstalling cabal-install:
$ ghc-pkg list
/usr/local/lib/ghc-7.0.1/package.conf.d:
Cabal-1.10.0.0
array-0.3.0.2
base-4.3.0.0
bin-package-db-0.0.0.0
bytestring-0.9.1.8
containers-0.4.0.0
directory-1.1.0.0
extensible-exceptions-0.1.1.2
ffi-1.0
filepath-1.2.0.0
(ghc-7.0.1)
(ghc-binary-0.5.0.2)
ghc-prim-0.2.0.0
(haskell2010-1.0.0.0)
haskell98-1.1.0.0
hpc-0.5.0.6
integer-gmp-0.2.0.2
old-locale-1.0.0.2
old-time-1.0.0.6
pretty-1.0.1.2
process-1.0.1.4
random-1.0.0.3
rts-1.0
template-haskell-2.5.0.0
time-1.2.0.3
unix-2.4.1.0
/home/moisei/.ghc/x86_64-linux-7.0.1/package.conf.d:
Cabal-1.8.0.6
HTTP-4000.1.0
ListLike-1.1.0
MonadCatchIO-transformers-0.2.2.2
PSQueue-1.1
attoparsec-0.8.2.0
attoparsec-iteratee-0.1.2
binary-0.5.0.2
bytestring-mmap-0.2.1
bytestring-nums-0.3.2
bytestring-show-0.3.4
cere containers-0.3.0.0
deepseq-1.1.0.2
directory-1.0.1.2
directory-tree-0.9.1
dlist-0.5
filepath-1.1.0.4
haskell98-1.1.0.0
iteratee-0.3.6
monads-fd-0.1.0.2
mtl-1.1.1.0
mtl-2.0.1.0
murmur-hash-0.1.0.2
network-2.2.1.10
network-2.3
network-bytestring-0.1.3.2
parsec-2.1.0.1
primitive-0.3.1
process-1.0.1.4
random-1.0.0.3
template-haskell-2.5.0.0
text-0.10.0.0
time-1.1.4
transformers-0.2.2.0
unix-compat-0.2
vector-0.7.0.1
zlib-0.5.2.0
These aren't cabal errors. The vector package doesn't build out of the box with GHC 7 (yet). You're an early adopter, jumping on GHC 7 before the Haskell Platform version is released.
As an early adopter, your duty is to report build errors to package maintainers.

Resources