Fail to install cairo haskell bindings on windows - haskell

I am trying to install cairo-0.12.4 Haskell package on Windows 7. I first downloaded and unpacked Gtk+2 and added its bin subdir to PATH. I then tried to run cabal with extra libs and includes:
cabal --extra-lib-dirs="d:\Program Files (x86)\Gtk+\lib"
--extra-include-dirs="d:\Program Files (x86)\Gtk+\include" install
But I got the following error
Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install cairo-0.12.4
Waiting for install task to finish...
Extracting
C:\Users\abailly\AppData\Roaming\cabal\packages\hackage.haskell.org\cairo\0.12.4\cairo-0.12.4.tar.gz
to C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368...
Updating cairo.cabal with the latest revision from the index.
creating
C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup
creating
C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist
creating
C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup
d:\Program Files (x86)\Haskell Platform\2012.2.0.0\bin\ghc.exe --make C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-
0.12.4\Setup.hs -o C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\setup.exe -odir C:\Users\abailly\
AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup -hidir C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.
12.4\dist\setup -i -iC:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4 -package Cabal-1.14.0
[1 of 2] Compiling SetupWrapper ( C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\SetupWrapper.hs, C:\Users
\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\SetupWrapper.o )
[2 of 2] Compiling Main ( C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\Setup.hs, C:\Users\abaill
y\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\Main.o )
Linking C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\setup.exe ...
C:\Users\abailly\AppData\Local\Temp\cairo-0.12.4-2368\cairo-0.12.4\dist\setup\setup.exe
configure --verbose=2 --ghc --prefix=C:\Users\abailly\AppData\Roaming\cabal
--user --flags=cairo_svg --flags=cairo_ps --flags=cairo_pdf
--extra-include-dirs=D:\Program Files (x86)\Gtk+\include
--extra-lib-dirs=D:\Program Files (x86)\Gtk+\lib --constraint=mtl ==2.1.2
--constraint=bytestring ==0.9.2.1 --constraint=base ==4.5.0.0
--constraint=array ==0.4.0.0 --disable-tests --disable-benchmarks
[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 cairo-0.12.4...
Flags chosen: cairo_svg=True, cairo_ps=True, cairo_pdf=True
Dependency array ==0.4.0.0: using array-0.4.0.0
Dependency base ==4.5.0.0: using base-4.5.0.0
Dependency bytestring ==0.9.2.1: using bytestring-0.9.2.1
Dependency mtl ==2.1.2: using mtl-2.1.2
Dependency cairo-pdf -any: using version 1.10.2
Dependency cairo-ps -any: using version 1.10.2
Dependency cairo-svg -any: using version 1.10.2
Dependency cairo >=1.2.0: using version 1.10.2
Using Cabal-1.14.0 compiled by ghc-7.4
Using compiler: ghc-7.4.1
Using install prefix: C:\Users\abailly\AppData\Roaming\cabal
Binaries installed in: C:\Users\abailly\AppData\Roaming\cabal\bin
Libraries installed in:
C:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4\ghc-7.4.1
Private binaries installed in:
C:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4
Data files installed in: C:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4
Documentation installed in:
C:\Users\abailly\AppData\Roaming\cabal\doc\cairo-0.12.4
Using alex version 3.0.1 found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\lib\extralibs\bin\alex.exe
Using ar found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\mingw\bin\ar.exe
No c2hs found
Using cpphs version 1.16 found on system at:
c:\Users\abailly\AppData\Roaming\cabal\bin\cpphs.exe
No ffihugs found
Using gcc version 4.5.2 found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\mingw\bin\gcc.exe
Using ghc version 7.4.1 found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\bin\ghc.exe
Using ghc-pkg version 7.4.1 found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\bin\ghc-pkg.exe
No greencard found
Using gtk2hsC2hs version 0.13.6 found on system at:
c:\Users\abailly\AppData\Roaming\cabal\bin\gtk2hsC2hs.exe
Using gtk2hsHookGenerator found on system at:
c:\Users\abailly\AppData\Roaming\cabal\bin\gtk2hsHookGenerator.exe
Using gtk2hsTypeGen found on system at:
c:\Users\abailly\AppData\Roaming\cabal\bin\gtk2hsTypeGen.exe
Using haddock version 2.10.0 found on system at: d:\Program Files
(x86)\Haskell Platform\2012.2.0.0\bin\haddock.exe
Using happy version 1.18.9 found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\lib\extralibs\bin\happy.exe
No hmake found
Using hpc version 0.6 found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\bin\hpc.exe
Using hsc2hs version 0.67 found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\bin\hsc2hs.exe
Using hscolour version 1.20 found on system at:
c:\Users\abailly\AppData\Roaming\cabal\bin\HsColour.exe
No hugs found
No jhc found
Using ld found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\mingw\bin\ld.exe
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.26 found on system at: d:\Program Files
(x86)\Gtk+\bin\pkg-config.exe
Using ranlib found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\mingw\bin\ranlib.exe
Using strip found on system at: d:\Program Files (x86)\Haskell
Platform\2012.2.0.0\mingw\bin\strip.exe
Using tar found on system at: D:\Program Files (x86)\Git\bin\tar.exe
No uhc found
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-pdf
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-ps
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-svg
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo
setup.exe: Missing dependencies on foreign libraries:
* Missing C libraries: z, cairo
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 cairo-0.12.4
cabal.exe: Error: some packages failed to install:
Chart-0.16 depends on cairo-0.12.4 which failed to install.
cairo-0.12.4 failed during the configure step. The exception was:
ExitFailure 1
splot-0.3.8 depends on cairo-0.12.4 which failed to install.
When I try to install cairo directly, I got the following:
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-pdf
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-ps
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo-svg
d:\Program Files (x86)\Gtk+\bin\pkg-config.exe --modversion cairo
setup.exe: Missing dependencies on foreign libraries:
* Missing C libraries: z, cairo
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 cairo-0.12.4
World file is already up to date.
cabal.exe: Error: some packages failed to install:
cairo-0.12.4 failed during the configure step. The exception was:
ExitFailure 1
I am clueless...

If you read the error message:
* Missing C libraries: z, cairo
It is saying you need to install the libraries (and header files) for the libraries libz and cairo. On *nix systems this usually means just installing the -dev versions of these packages with your package manager. On windows I assume you'd download the source version of the library and install.

I got this problem. In my case it was a mismatch between a 64-bit ghc and a 32-bit cairo dll

I moved the Gtk+ library to D:\soft\gtk+\ and everything runs fine. The path to Gtk+ contain space which does not seem to be correctly interpreted by cabal/ghc, although I double-quoted it:
--extra-lib-dirs="d:\Program Files (x86)\Gtk+\lib"
Solution: Put gtk+ in a space-free location.
Update: Now, it fails to install Chart-0.16 with an even more cryptic error:
Loading package Win32-2.2.2.0 ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package time-1.4 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package data-accessor-0.2.2.3 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package utility-ht-0.0.8 ... linking ... done.
Loading package data-accessor-template-0.2.1.10 ... linking ... done.
Loading package colour-2.3.3 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
*** gcc:
"D:\Program Files (x86)\Haskell Platform\2012.2.0.0\lib/../mingw/bin/gcc.exe" "-fno-stack-protector" "-Wl,--hash-size=31" "-Wl,--r
educe-memory-overheads" "-LC:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4\ghc-7.4.1" "-Ld:/soft/Gtk+/lib" "--print-file-name"
"libz.dll"
*** gcc:
"D:\Program Files (x86)\Haskell Platform\2012.2.0.0\lib/../mingw/bin/gcc.exe" "-fno-stack-protector" "-Wl,--hash-size=31" "-Wl,--r
educe-memory-overheads" "-LC:\Users\abailly\AppData\Roaming\cabal\cairo-0.12.4\ghc-7.4.1" "-Ld:/soft/Gtk+/lib" "--print-file-name"
"libcairo-2.dll"
Loading package cairo-0.12.4 ... d:\Program Files (x86)\Haskell Platform\2012.2.0.0\bin\ghc.exe returned
ExitFailure 1
Failed to install Chart-0.16
cabal.exe: Error: some packages failed to install:
Chart-0.16 failed during the building phase. The exception was:
ExitFailure 1
splot-0.3.8 depends on Chart-0.16 which failed to install.
I suspect this is due to a linking error as the compilation runs fine when I execute the following command which is what cabal outputs in debug mode:
"D:\\Program Files (x86)\\Haskell Platform\\2012.2.0.0\\bin\\ghc.exe"
"--make" "-v" "-fbuilding-cabal-package" "-O" "-odir" "dist\\build"
"-hidir" "dist\\build" "-stubdir" "dist\\build" "-i" "-idist\\build"
"-i." "-idist\\build\\autogen" "-Idist\\build\\autogen"
"-Idist\\build" "-optP-include"
"-optPdist\\build\\autogen\\cabal_macros.h" "-package-name"
"Chart-0.16" "-hide-all-packages" "-package-conf"
"dist\\package.conf.inplace" "-package-id"
"array-0.4.0.0-3cf1bc3f5cd0078adea24752c18081b9" "-package-id"
"base-4.5.0.0-597748f6f53a7442bcae283373264bb6" "-package-id"
"cairo-0.12.4-f04021ea456c901e8d05395a31f7a861" "-package-id"
"colour-2.3.3-4eaa610bb6d825a7334e1b3de448f6c0" "-package-id"
"data-accessor-0.2.2.3-5477c48e3478339fdff299c536a033c6" "-package-id"
"data-accessor-template-0.2.1.10-28ee96821fd908880f3a49417c4da548"
"-package-id" "mtl-2.1.2-7ec8bbada2af74b49c6e4aeea2889fdc"
"-package-id" "old-locale-1.0.0.4-29bd50ed2bb4a20928338f52e4ab1b71"
"-package-id" "time-1.4-01d7bf22d87e70510fe9ee4c4434b3ab"
"-XHaskell98" "Graphics.Rendering.Chart"
"Graphics.Rendering.Chart.Types" "Graphics.Rendering.Chart.Renderable"
"Graphics.Rendering.Chart.Axis"
"Graphics.Rendering.Chart.Axis.Floating"
"Graphics.Rendering.Chart.Axis.Indexed"
"Graphics.Rendering.Chart.Axis.Int"
"Graphics.Rendering.Chart.Axis.LocalTime"
"Graphics.Rendering.Chart.Axis.Types"
"Graphics.Rendering.Chart.Axis.Unit" "Graphics.Rendering.Chart.Layout"
"Graphics.Rendering.Chart.Legend" "Graphics.Rendering.Chart.Simple"
"Graphics.Rendering.Chart.Simple.Internal"
"Graphics.Rendering.Chart.Grid" "Graphics.Rendering.Chart.Plot"
"Graphics.Rendering.Chart.Plot.Types"
"Graphics.Rendering.Chart.Plot.Annotation"
"Graphics.Rendering.Chart.Plot.AreaSpots"
"Graphics.Rendering.Chart.Plot.Bars"
"Graphics.Rendering.Chart.Plot.Candle"
"Graphics.Rendering.Chart.Plot.ErrBars"
"Graphics.Rendering.Chart.Plot.FillBetween"
"Graphics.Rendering.Chart.Plot.Hidden"
"Graphics.Rendering.Chart.Plot.Lines"
"Graphics.Rendering.Chart.Plot.Pie"
"Graphics.Rendering.Chart.Plot.Points"
"Graphics.Rendering.Chart.SparkLine" "-hide-package" "monads-tf"
I am even more puzzled...
Update (2): When I run cabal install > out 2>&1 it succeeds!

Related

Having dependency issues while trying to install ThreadScope with Stack. The issue seems to revolve around cairo-0.13.8.1

I am trying to install ThreadScope using stack install threadscope.
Stack has given me recommendations of packages to add to my global stack.yaml file. I have followed all of its advice. This is from ~/.stack/global-project/stack.yaml:
extra-deps:
- gtk2hs-buildtools-0.13.8.0
- cairo-0.13.8.1
- glib-0.13.8.1
- gtk-0.15.5
- pango-0.13.8.1
- gio-0.13.8.1
Then I run:
stack install threadscope
cairo > configure
cairo > [1 of 2] Compiling Main ( /tmp/stack-aa04726c2a449768/cairo-0.13.8.1/Setup.hs, /tmp/stack-aa04726c2a449768/cairo-0.13.8.1/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup/Main.o )
cairo > [2 of 2] Compiling StackSetupShim ( /home/nick/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack-aa04726c2a449768/cairo-0.13.8.1/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup/StackSetupShim.o )
cairo > Linking /tmp/stack-aa04726c2a449768/cairo-0.13.8.1/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup/setup ...
cairo > Configuring cairo-0.13.8.1...
cairo > setup: The pkg-config package 'cairo' version ==1.2.0 || >1.2.0 is required
cairo > but it could not be found.
cairo >
-- While building package cairo-0.13.8.1 using:
/tmp/stack-aa04726c2a449768/cairo-0.13.8.1/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup/setup --builddir=.s
tack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0 configure --user --package-db=clear --package-db=global --package-db=/home/ni
ck/.stack/snapshots/x86_64-linux-tinfo6/2544cb5dce03ac8ef66db22fb64cd85312efb9806f5e1b516e14ea204c4e266b/8.8.3/pkgdb --libdir
=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/2544cb5dce03ac8ef66db22fb64cd85312efb9806f5e1b516e14ea204c4e266b/8.8.3/lib -
-bindir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/2544cb5dce03ac8ef66db22fb64cd85312efb9806f5e1b516e14ea204c4e266b/8.8.3
/bin --datadir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/2544cb5dce03ac8ef66db22fb64cd85312efb9806f5e1b516e14ea204c4e26
6b/8.8.3/share --libexecdir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/2544cb5dce03ac8ef66db22fb64cd85312efb9806f5e1b516e
14ea204c4e266b/8.8.3/libexec --sysconfdir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/2544cb5dce03ac8ef66db22fb64cd85312e
fb9806f5e1b516e14ea204c4e266b/8.8.3/etc --docdir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/2544cb5dce03ac8ef66db22fb64c
d85312efb9806f5e1b516e14ea204c4e266b/8.8.3/doc/cairo-0.13.8.1 --htmldir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/2544c
b5dce03ac8ef66db22fb64cd85312efb9806f5e1b516e14ea204c4e266b/8.8.3/doc/cairo-0.13.8.1 --haddockdir=/home/nick/.stack/snapshots
/x86_64-linux-tinfo6/2544cb5dce03ac8ef66db22fb64cd85312efb9806f5e1b516e14ea204c4e266b/8.8.3/doc/cairo-0.13.8.1 --dependency=
Cabal=Cabal-3.0.1.0 --dependency=array=array-0.5.4.0 --dependency=base=base-4.13.0.0 --dependency=bytestring=bytestring-0.10.10
.0 --dependency=gtk2hs-buildtools=gtk2hs-buildtools-0.13.8.0-Bwvbdih7QpVGW3kWnJA1H3 --dependency=mtl=mtl-2.2.2 --dependency=te
xt=text-1.2.4.0 --dependency=utf8-string=utf8-string-1.0.1.1-IRxNMq5AVf036EceEkASq3 -fcairo_pdf -fcairo_ps -fcairo_svg --exact-configuration --ghc-option=-fhide-source-paths
Process exited with code: ExitFailure 1
Progress 1/4
Ok so cairo seems to be the problem.
stack install cairo
cairo> configure
cairo> [1 of 2] Compiling Main ( /tmp/stack-e9ffd2e58a879ecc/cairo-0.13.8.1/Setup.hs, /tmp/stack-e9ffd2e58a879ecc/cairo-0.13.8.1/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup/Main.o )
cairo> [2 of 2] Compiling StackSetupShim ( /home/nick/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack-e9ffd2e58a879ecc/cairo-0.13.8.1/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup/StackSetupShim.o )
cairo> Linking /tmp/stack-e9ffd2e58a879ecc/cairo-0.13.8.1/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup/setup ...
cairo> Configuring cairo-0.13.8.1...
cairo> setup: The pkg-config package 'cairo' version ==1.2.0 || >1.2.0 is required
cairo> but it could not be found.
cairo>
-- While building package cairo-0.13.8.1 using:
/tmp/stack-e9ffd2e58a879ecc/cairo-0.13.8.1/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup/setup
--builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0 configure --user --package-db=clear --package-db=global
--package-db=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/b9bd790e3091cf3e10cc5b6c0aa6789904463f24721de0b3576c4a5f79
a7d5d8/8.8.3/pkgdb --libdir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/b9bd790e3091cf3e10cc5b6c0aa6789904463f24
721de0b3576c4a5f79a7d5d8/8.8.3/lib --bindir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/b9bd790e3091cf3e10cc5b6c
0aa6789904463f24721de0b3576c4a5f79a7d5d8/8.8.3/bin --datadir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/b9bd790
e3091cf3e10cc5b6c0aa6789904463f24721de0b3576c4a5f79a7d5d8/8.8.3/share --libexecdir=/home/nick/.stack/snapshots/x86_64
-linux-tinfo6/b9bd790e3091cf3e10cc5b6c0aa6789904463f24721de0b3576c4a5f79a7d5d8/8.8.3/libexec --sysconfdir=/home/nick/
.stack/snapshots/x86_64-linux-tinfo6/b9bd790e3091cf3e10cc5b6c0aa6789904463f24721de0b3576c4a5f79a7d5d8/8.8.3/etc --doc
dir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/b9bd790e3091cf3e10cc5b6c0aa6789904463f24721de0b3576c4a5f79a7d5d8
/8.8.3/doc/cairo-0.13.8.1 --htmldir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6/b9bd790e3091cf3e10cc5b6c0aa678990
4463f24721de0b3576c4a5f79a7d5d8/8.8.3/doc/cairo-0.13.8.1 --haddockdir=/home/nick/.stack/snapshots/x86_64-linux-tinfo6
/b9bd790e3091cf3e10cc5b6c0aa6789904463f24721de0b3576c4a5f79a7d5d8/8.8.3/doc/cairo-0.13.8.1 --dependency=Cabal=Cabal-3
.0.1.0 --dependency=array=array-0.5.4.0 --dependency=base=base-4.13.0.0 --dependency=bytestring=bytestring-0.10.10.0 -
-dependency=gtk2hs-buildtools=gtk2hs-buildtools-0.13.8.0-Bwvbdih7QpVGW3kWnJA1H3 --dependency=mtl=mtl-2.2.2 --depende
ncy=text=text-1.2.4.0 --dependency=utf8-string=utf8-string-1.0.1.1-IRxNMq5AVf036EceEkASq3 -fcairo_pdf -fcairo_ps
-fcairo_svg --exact-configuration --ghc-option=-fhide-source-paths
Process exited with code: ExitFailure 1
What stands out to me in this error is the line: setup: The pkg-config package 'cairo' version ==1.2.0 || >1.2.0 is required. Hmm does this mean I should first attempt to install an older version of Cairo? I tried that but did not have any luck.
I have tried to run the commands:
stack upgrade --git --source-only
stack build cairo
I got the same error as when I ran stack install cairo.
If I run which stack I get back /home/nick/.local/bin/stack
Finally, here is what happens if I try stack install gtk2hs-buildtools:
Copying from /home/nick/.stack/snapshots/x86_64-linux-tinfo6/59804b23a4d63c47966b839bf0007deca79c979c9d5aa499d8828f7acbc09797/8.8.3/bin/gtk2hsC2hs to /home/nick/.local/bin/gtk2hsC2hs
Copying from /home/nick/.stack/snapshots/x86_64-linux-tinfo6/59804b23a4d63c47966b839bf0007deca79c979c9d5aa499d8828f7acbc09797/8.8.3/bin/gtk2hsHookGenerator to /home/nick/.local/bin/gtk2hsHookGenerator
Copying from /home/nick/.stack/snapshots/x86_64-linux-tinfo6/59804b23a4d63c47966b839bf0007deca79c979c9d5aa499d8828f7acbc09797/8.8.3/bin/gtk2hsTypeGen to /home/nick/.local/bin/gtk2hsTypeGen
Copied executables to /home/nick/.local/bin:
- gtk2hsC2hs
- gtk2hsHookGenerator
- gtk2hsTypeGen
Warning: The gtk2hsC2hs executable found on the PATH environment variable is /home/nick/.cabal/bin/gtk2hsC2hs and not the version that was just installed. This means that gtk2hsC2hs
calls on the command line will not use this version.
Warning: The gtk2hsHookGenerator executable found on the PATH environment variable is /home/nick/.cabal/bin/gtk2hsHookGenerator and not the version that was just installed. This means that
gtk2hsHookGenerator calls on the command line will not use this version.
Warning: The gtk2hsTypeGen executable found on the PATH environment variable is /home/nick/.cabal/bin/gtk2hsTypeGen and not the version that was just installed. This means that gtk2hsTypeGen
calls on the command line will not use this version.
pkg-config is looking for a package named cairo, which can be confusing as it has the same name as the Haskell cairo package. This is the useful part of the build log:
cairo> setup: The pkg-config package 'cairo' version ==1.2.0 || >1.2.0 is required
cairo> but it could not be found.
pkg-config is searching the PKG_CONFIG_PATH for a file named cairo.pc. On Debian this is provided by the libcairo2-dev package.

Installing Euterpea for computer music applications and Haskell

I followed the instructions here http://www.euterpea.com for installing Euterpea (a domain-specific language for computer music applications embedded in Haskell), and I received a message that certain packages and things failed to install (see the code below). How can I install the remaining packages?
Mo-MacBook-Pro:~ Mo$ cabal update
Downloading the latest package list from hackage.haskell.org
cabal install Euterpea
To revert to previous state run:
cabal update --index-state='2018-06-25T08:34:14Z'
Mo-MacBook-Pro:~ Mo$ cabal install Euterpea
clang: warning: argument unused during compilation: '-nopie' [-Wunused-
command-line-argument]
Resolving dependencies...
Downloading heap-1.0.4...
Downloading PortMidi-0.1.6.1...
Configuring PortMidi-0.1.6.1...
Downloading lazysmallcheck-0.6...
Configuring heap-1.0.4...
Downloading semigroups-0.18.5...
Configuring lazysmallcheck-0.6...
Configuring semigroups-0.18.5...
Building heap-1.0.4...
Building PortMidi-0.1.6.1...
Building lazysmallcheck-0.6...
Building semigroups-0.18.5...
Installed semigroups-0.18.5
Downloading stm-2.5.0.0...
Configuring stm-2.5.0.0...
Installed lazysmallcheck-0.6
Downloading HCodecs-0.5.1...
Installed heap-1.0.4
Downloading Stream-0.4.7.2...
Configuring HCodecs-0.5.1...
Configuring Stream-0.4.7.2...
Building stm-2.5.0.0...
Building HCodecs-0.5.1...
Building Stream-0.4.7.2...
Failed to install HCodecs-0.5.1
Build log ( /Users/Mo/.cabal/logs/ghc-8.4.3/HCodecs-0.5.1-
BtnY8oBJJ5FGnsoQaqbvOm.log ):
cabal: Entering directory
'/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-
5294/HCodecs-0.5.1'
Configuring HCodecs-0.5.1...
clang: warning: argument unused during compilation: '-nopie' [-Wunused-
command-line-argument]
Preprocessing library for HCodecs-0.5.1..
Building library for HCodecs-0.5.1..
<command line>: cannot satisfy -package-id random-1.1-
7T1TXpwb46H1j0av1OnVaD
(use -v for more information)
cabal: Leaving directory
'/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-
5294/HCodecs-0.5.1'
Failed to install Stream-0.4.7.2
Build log ( /Users/Mo/.cabal/logs/ghc-8.4.3/Stream-0.4.7.2-
ES6rey5IgWg9tsXDghlP7Y.log ):
cabal: Entering directory
'/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-
5295/Stream-0.4.7.2'
Warning: Stream.cabal:6:4: Tabs used as indentation at 6:4, 12:4, 13:4,
14:4,
15:4, 16:4, 17:4
Configuring Stream-0.4.7.2...
clang: warning: argument unused during compilation: '-nopie' [-Wunused-
command-line-argument]
Preprocessing library for Stream-0.4.7.2..
Building library for Stream-0.4.7.2..
<command line>: cannot satisfy -package-id QuickCheck-2.11.3-
4Q6LQ7mN6Tj8otrLuHN0se
(use -v for more information)
cabal: Leaving directory
'/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-
5295/Stream-0.4.7.2'
Installed PortMidi-0.1.6.1
Installed stm-2.5.0.0
cabal: Error: some packages failed to install:
Euterpea-2.0.6-LLo28S848YneLemh6QUkK depends on Euterpea-2.0.6 which
failed to
install.
HCodecs-0.5.1-BtnY8oBJJ5FGnsoQaqbvOm failed during the building phase.
The
exception was:
ExitFailure 1
Stream-0.4.7.2-ES6rey5IgWg9tsXDghlP7Y failed during the building phase.
The
exception was:
ExitFailure 1
arrows-0.4.4.2-GLke2GgDEro6Tzj3MGmTOB depends on arrows-0.4.4.2 which
failed
to install.
It would be great if someone could help. Thanks.
I have included all the code, lest some particular relevant detail was omitted.
Edit
I have also tried to install Euterpea via stack. I get this message:
Mo-MacBook-Pro:~ Mo$ stack install Euterpea
Error: While constructing the build plan, the following exceptions were
encountered:
In the dependencies for Euterpea-2.0.6:
PortMidi must match ==0.1.6.1, but the stack configuration has no specified version (latest matching version is 0.1.6.1)
arrows must match >=0.4 && <0.5, but the stack configuration has no specified version (latest matching version is 0.4.4.2)
needed since Euterpea is a build target.
Some different approaches to resolving this:
* Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build configuration. This can be convenient when dealing with many complicated constraint
errors, but results may be unpredictable.
* Recommended action: try adding the following to your extra-deps in /Users/Mo/.stack/global-project/stack.yaml:
- PortMidi-0.1.6.1
- arrows-0.4.4.2
Plan construction failed.
--
Edit 2.
As suggested below, I tried cabal install random-1.1 --force-reinstalls which generated:
clang: warning: argument unused during compilation: '-nopie' [- Wunused-command-line-argument]
Resolving dependencies...
Warning: The following packages are likely to be broken by the reinstalls:
tf-random-0.5
QuickCheck-2.11.3
Continuing even though the plan contains dangerous reinstalls.
Configuring random-1.1...
Building random-1.1...
Installed random-1.1
Then
Mo-MacBook-Pro:~ Mo$ cabal install Euterpea
clang: warning: argument unused during compilation: '-nopie' [- Wunused-command-line-argument]
Resolving dependencies...
Configuring Stream-0.4.7.2...
Configuring HCodecs-0.5.1...
Building HCodecs-0.5.1...
Building Stream-0.4.7.2...
Failed to install HCodecs-0.5.1
Build log ( /Users/lukeburke/.cabal/logs/ghc-8.4.3/HCodecs-0.5.1- BtnY8oBJJ5FGnsoQaqbvOm.log ):
cabal: Entering directory '/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-20742/HCodecs- 0.5.1'
Configuring HCodecs-0.5.1...
clang: warning: argument unused during compilation: '-nopie' [- Wunused-command-line-argument]
Preprocessing library for HCodecs-0.5.1..
Building library for HCodecs-0.5.1..
<command line>: cannot satisfy -package-id random-1.1- 7T1TXpwb46H1j0av1OnVaD
(use -v for more information)
cabal: Leaving directory '/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-20742/HCodecs- 0.5.1'
Failed to install Stream-0.4.7.2
Build log ( /Users/Mo/.cabal/logs/ghc-8.4.3/Stream-0.4.7.2- ES6rey5IgWg9tsXDghlP7Y.log ):
cabal: Entering directory '/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-20743/Stream- 0.4.7.2'
Warning: Stream.cabal:6:4: Tabs used as indentation at 6:4, 12:4, 13:4, 14:4,
15:4, 16:4, 17:4
Configuring Stream-0.4.7.2...
clang: warning: argument unused during compilation: '-nopie' [- Wunused-command-line-argument]
Preprocessing library for Stream-0.4.7.2..
Building library for Stream-0.4.7.2..
<command line>: cannot satisfy -package-id QuickCheck-2.11.3- 4Q6LQ7mN6Tj8otrLuHN0se
(use -v for more information)
cabal: Leaving directory '/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-20743/Stream- 0.4.7.2'
cabal: Error: some packages failed to install:
Euterpea-2.0.6-LLo28S848YneLemh6QUkK depends on Euterpea-2.0.6 which failed to
install.
HCodecs-0.5.1-BtnY8oBJJ5FGnsoQaqbvOm failed during the building phase. The
exception was:
ExitFailure 1
Stream-0.4.7.2-ES6rey5IgWg9tsXDghlP7Y failed during the building phase. The
exception was:
ExitFailure 1
arrows-0.4.4.2-GLke2GgDEro6Tzj3MGmTOB depends on arrows-0.4.4.2 which failed
to install.
Edit 3
It has been suggested below that multiple packages are botched and that I should try re-installing all of them (in a single command, i.e. cabal install random tf-random QuickCheck Euterpea --force-reinstalls.
However, if I write cabal install random tf-random QuickCheck Euterpea --force-reinstalls I receive the following code:
clang: warning: argument unused during compilation: '-nopie' [- Wunused-command-line-argument]
Resolving dependencies...
Warning: The following packages are likely to be broken by the reinstalls:
QuickCheck-2.11.3
Continuing even though the plan contains dangerous reinstalls.
Downloading erf-2.0.0.0...
Configuring random-1.1...
Configuring erf-2.0.0.0...
Building random-1.1...
Building erf-2.0.0.0...
Installed erf-2.0.0.0
Installed random-1.1
Downloading tf-random-0.5...
Configuring tf-random-0.5...
Building tf-random-0.5...
Failed to install tf-random-0.5
Build log ( /Users/Mo/.cabal/logs/ghc-8.4.3/tf-random-0.5- ADZoyzEXgHe6hyR0Bycce0.log ):
cabal: Entering directory '/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-21584/tf- random-0.5'
Configuring tf-random-0.5...
clang: warning: argument unused during compilation: '-nopie' [- Wunused-command-line-argument]
Preprocessing library for tf-random-0.5..
Building library for tf-random-0.5..
<command line>: cannot satisfy -package-id primitive-0.6.4.0- 9k41Y6ToOAE8KXK6VMGV2O
(use -v for more information)
cabal: Leaving directory '/var/folders/dy/q51p3v595kbd8_wclmt80v700000gn/T/cabal-tmp-21584/tf- random-0.5'
cabal: Error: some packages failed to install:
Euterpea-2.0.6-87WYqltNL8w8teqXOsc4TL depends on Euterpea-2.0.6 which failed
to install.
HCodecs-0.5.1-DrGKEnNk6EBHti2goL6KP5 depends on HCodecs-0.5.1 which. failed to
install.
QuickCheck-2.12.6.1-KuXpgimNOXzF2SmGPEs5LR depends on QuickCheck- 2.12.6.1
which failed to install.
Stream-0.4.7.2-FedzVSwUnWMDxlzmPNWt7x depends on Stream-0.4.7.2 which failed
to install.
arrows-0.4.4.2-EGvZPpby4BcD99TcXDoCg4 depends on arrows-0.4.4.2 which. failed
to install.
tf-random-0.5-ADZoyzEXgHe6hyR0Bycce0 failed during the building phase. The
exception was:
ExitFailure 1
What can I do to install Euterpea?
Installing the Euterpea package
This answer uses LTS 12.26 as I've verified it works, but this should work for most LTS releases (see bottom of step 2 for details).
Make a new Stack project:
stack new euter-test
cd euter-test
Edit stack.yaml and set the LTS to 12.26 and extra-deps to specify the versions of packages that aren't present in the LTS but are present on Hackage:
resolver: lts-12.26
...
extra-deps:
- Euterpea-2.0.6
- PortMidi-0.1.6.1
- arrows-0.4.4.2
- Stream-0.4.7.2
- lazysmallcheck-0.6
The errors you were getting on the Stack install ("PortMidi must match ==0.1.6.1, but the stack configuration has no specified version") indicate that a package you're using requires a particular version of a library, but the package repository (LTS snapshot) doesn't contain that library, so you need to specify it explicitly. Stack then prints which library and version is missing, so you can just keep trying stack build and adding the libraries until the build succeeds.
We use LTS 12.26 here, but by adding the extra-deps packages as described above, you should be able to get it working on any LTS.
Edit package.yaml and add Euterpea to the list of dependencies:
dependencies:
...
- Euterpea
A simple test in app/Main.hs:
module Main where
import Euterpea
main :: IO ()
main = play $ c 4 qn
Run stack build:
lazysmallcheck-0.6: download
heap-1.0.4: download
heap-1.0.4: configure
HCodecs-0.5.1: download
PortMidi-0.1.6.1: download
heap-1.0.4: build
lazysmallcheck-0.6: configure
lazysmallcheck-0.6: build
HCodecs-0.5.1: configure
HCodecs-0.5.1: build
PortMidi-0.1.6.1: configure
heap-1.0.4: copy/register
lazysmallcheck-0.6: copy/register
PortMidi-0.1.6.1: build
Stream-0.4.7.2: download
Stream-0.4.7.2: configure
Stream-0.4.7.2: build
Stream-0.4.7.2: copy/register
PortMidi-0.1.6.1: copy/register
arrows-0.4.4.2: download
arrows-0.4.4.2: configure
arrows-0.4.4.2: build
arrows-0.4.4.2: copy/register
HCodecs-0.5.1: copy/register
Euterpea-2.0.6: download
Euterpea-2.0.6: configure
Euterpea-2.0.6: build
Euterpea-2.0.6: copy/register
Building all executables for `euter' once. After a successful build of all of them, only specified executables will be rebuilt.
euter-0.1.0.0: configure (lib + exe)
Configuring euter-0.1.0.0...
euter-0.1.0.0: build (lib + exe)
Preprocessing library for euter-0.1.0.0..
Building library for euter-0.1.0.0..
[1 of 2] Compiling Lib ( src/Lib.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Lib.o )
[2 of 2] Compiling Paths_euter ( .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/autogen/Paths_euter.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Paths_euter.o )
Preprocessing executable 'euter-exe' for euter-0.1.0.0..
Building executable 'euter-exe' for euter-0.1.0.0..
[1 of 2] Compiling Main ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/euter-exe/euter-exe-tmp/Main.o )
[2 of 2] Compiling Paths_euter ( .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/euter-exe/autogen/Paths_euter.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/euter-exe/euter-exe-tmp/Paths_euter.o )
Linking .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/euter-exe/euter-exe ...
euter-0.1.0.0: copy/register
Installing library in <...>
Installing executable euter-exe in <...>
Registering library for euter-0.1.0.0..
Running the executable produced by the project should emit a tone if you're running a MIDI synthesiser:
stack exec euter-test-exe
Troubleshooting
If you get an error like *** Exception: No MIDI outputs!, then you're not running a MIDI synthesiser (see below). Make sure you run it in the background (eg. in another terminal).
If you don't get an error but there's no audio output, try running devices in GHCI to see what outputs are available, and then use playDev x instead of play, where x is the OutputDeviceID of the synth input port. Eg:
> devices
Input devices:
InputDeviceID 1 Midi Through Port-0
Output devices:
OutputDeviceID 0 Midi Through Port-0
OutputDeviceID 2 Synth input port (25952:0)
> playDev 2 $ c 4 qn
If you run devices and don't see any synth input ports, but you have fluidsynth running in the background, then you might need to restart ghci and try again.
Running a MIDI synthesiser
Here's a quick step-by-step to get Fluidsynth running on Debian (with guesses at a Mac setup along the way).
Install fluidsynth:
On Debian this is sudo apt install fluidsynth, on mac it could be brew install fluidsynth - there's quite a few articles on how to do this, just google it if in doubt.
Run fluidsynth:
On Debian using ALSA this is
fluidsynth -s -a alsa -m alsa_seq /usr/share/sounds/sf2/FluidR3_GM.sf2
Instructing fluidsynth to run in server mode, use alsa as the audio driver and alsa_seq as the MIDI driver, and use the soundfont FluidR3_GM.sf2 (should be installed as part of the fluidsynth install).
On Mac, it seems like the correct commandline is:
fluidsynth -s -a coreaudio -m coremidi /usr/share/sounds/sf2/FluidR3_GM.sf2
If you can't find the FluidR3_GM.sf2 file then it's likely it's been installed in a different location. As a last resort, you can just download a soundfont file and use that rather than the one provided by FluidSynth.
After running this, you should be given a prompt and maybe a few warnings, and fluidsynth will be running. Make sure it's running before using Euterpea, and keep it running while using Euterpea.

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

cabal install regex-dfa fails

I'm trying to install the regex-dfa package. I installed other regex packages like regex-tdfa, and they worked fine.
However, when I run sudo cabal install regex-dfa I get an error message:
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/regex-dfa-0.91-9125/regex-dfa-0.91/Setup.hs, /tmp/regex-dfa-0.91-9125/regex-dfa-0.91/dist/setup/Main.o )
Linking /tmp/regex-dfa-0.91-9125/regex-dfa-0.91/dist/setup/setup ...
Configuring regex-dfa-0.91...
Warning: No 'build-type' specified. If you do not need a custom Setup.hs or
./configure script then use 'build-type: Simple'.
Building regex-dfa-0.91...
Preprocessing library regex-dfa-0.91...
Text/Regex/DFA/Wrap.hs:1:16: Warning:
-fglasgow-exts is deprecated: Use individual extensions instead
<no location info>:
Failing due to -Werror.
Failed to install regex-dfa-0.91
cabal: Error: some packages failed to install:
regex-dfa-0.91 failed during the building phase. The exception was:
ExitFailure 1
What can I do about this?
The package is very old, the last (and the only) upload was in 2007. Don't use it if you can. Or contact the maintainer and ask him to update the package.
To fix this particular issue, you can cabal unpack regex-dfa, remove the -Werror and then cabal install it. But I'm not sure you will get another build error after that.

Failed to install ghcjs-dom-0.0.7 - src/GHCJS/DOM.hs:3:14: Unsupported extension: JavaScriptFFI

I have problems installing Leksah, the depends on ghcjs-dom:
Here's what I precisely get when trying to install this precise package:
$ cabal install ghcjs-dom -v
Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install ghcjs-dom-0.0.7
Waiting for install task to finish...
Extracting
/Users/bastiengallay/Library/Haskell/repo-cache/hackage.haskell.org/ghcjs-dom/0.0.7/ghcjs-dom-0.0.7.tar.gz
to /var/folders/1s/mnr_nf9x1c3fr5v_bcrg712m0000gn/T/ghcjs-dom-0.0.7-24896...
Updating ghcjs-dom.cabal with the latest revision from the index.
Configuring ghcjs-dom-0.0.7...
Flags chosen: gtk3=True, jsc=False, webkit=False, jsffi=False, ghcjs=True
Dependency base ==4.6.0.1: using base-4.6.0.1
Dependency mtl ==2.2.0.1: using mtl-2.2.0.1
Using Cabal-1.20.0.0 compiled by ghc-7.6
Using compiler: ghc-7.6.3
Using install prefix:
/Users/bastiengallay/Library/Haskell/ghc-7.6.3/lib/ghcjs-dom-0.0.7
Binaries installed in:
/Users/bastiengallay/Library/Haskell/ghc-7.6.3/lib/ghcjs-dom-0.0.7/bin
Libraries installed in:
/Users/bastiengallay/Library/Haskell/ghc-7.6.3/lib/ghcjs-dom-0.0.7/lib
Private binaries installed in:
/Users/bastiengallay/Library/Haskell/ghc-7.6.3/lib/ghcjs-dom-0.0.7/libexec
Data files installed in:
/Users/bastiengallay/Library/Haskell/ghc-7.6.3/lib/ghcjs-dom-0.0.7/share
Documentation installed in:
/Users/bastiengallay/Library/Haskell/ghc-7.6.3/lib/ghcjs-dom-0.0.7/doc
Configuration files installed in:
/Users/bastiengallay/Library/Haskell/ghc-7.6.3/lib/ghcjs-dom-0.0.7/etc
Using alex version 3.1.3 found on system at:
/Users/bastiengallay/Library/Haskell/bin/alex
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.8.3 found on system at: /usr/local/bin/gcc
Using ghc version 7.6.3 found on system at: /usr/local/bin/ghc
Using ghc-pkg version 7.6.3 found on system at: /usr/local/bin/ghc-pkg
No greencard found
Using haddock version 2.13.2 found on system at: /usr/local/bin/haddock
Using happy version 1.19.3 found on system at:
/Users/bastiengallay/Library/Haskell/bin/happy
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.6 found on system at: /usr/local/bin/hpc
Using hsc2hs version 0.67 found on system at: /usr/local/bin/hsc2hs
No hscolour found
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.28 found on system at: /usr/local/bin/pkg-config
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
Component build order: library
creating dist/build
creating dist/build/autogen
Building ghcjs-dom-0.0.7...
Preprocessing library ghcjs-dom-0.0.7...
Building library...
creating dist/build
/usr/local/bin/ghc --make -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -package-name ghcjs-dom-0.0.7 -hide-all-packages -package-db dist/package.conf.inplace -package-id base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57 -package-id mtl-2.2.0.1-ef91e0abcf7a4fb581ecb7fe83cdcba1 -XHaskell2010 GHCJS.DOM GHCJS.DOM.Types GHCJS.DOM.Attr GHCJS.DOM.BarProp GHCJS.DOM.Blob GHCJS.DOM.CharacterData GHCJS.DOM.Console GHCJS.DOM.Css GHCJS.DOM.CSSRule GHCJS.DOM.CSSRuleList GHCJS.DOM.CSSStyleDeclaration GHCJS.DOM.CSSStyleSheet GHCJS.DOM.CSSValue GHCJS.DOM.Document GHCJS.DOM.DocumentType GHCJS.DOM.DOMApplicationCache GHCJS.DOM.DOMImplementation GHCJS.DOM.DOMMimeType GHCJS.DOM.DOMMimeTypeArray GHCJS.DOM.DOMNamedFlowCollection GHCJS.DOM.DOMPlugin GHCJS.DOM.DOMPluginArray GHCJS.DOM.DOMSelection GHCJS.DOM.DOMSettableTokenList GHCJS.DOM.DOMTokenList GHCJS.DOM.DOMWindow GHCJS.DOM.DOMWindowCSS GHCJS.DOM.Element GHCJS.DOM.Event GHCJS.DOM.EventM GHCJS.DOM.Events GHCJS.DOM.EventTargetClosures GHCJS.DOM.File GHCJS.DOM.FileList GHCJS.DOM.History GHCJS.DOM.HTMLAnchorElement GHCJS.DOM.HTMLAppletElement GHCJS.DOM.HTMLAreaElement GHCJS.DOM.HTMLBaseElement GHCJS.DOM.HTMLBaseFontElement GHCJS.DOM.HTMLBodyElement GHCJS.DOM.HTMLBRElement GHCJS.DOM.HTMLButtonElement GHCJS.DOM.HTMLCollection GHCJS.DOM.HTMLDirectoryElement GHCJS.DOM.HTMLDivElement GHCJS.DOM.HTMLDListElement GHCJS.DOM.HTMLDocument GHCJS.DOM.HTMLElement GHCJS.DOM.HTMLFieldSetElement GHCJS.DOM.HTMLFontElement GHCJS.DOM.HTMLFormElement GHCJS.DOM.HTMLFrameElement GHCJS.DOM.HTMLFrameSetElement GHCJS.DOM.HTMLHeadElement GHCJS.DOM.HTMLHeadingElement GHCJS.DOM.HTMLHRElement GHCJS.DOM.HTMLHtmlElement GHCJS.DOM.HTMLIFrameElement GHCJS.DOM.HTMLImageElement GHCJS.DOM.HTMLInputElement GHCJS.DOM.HTMLLabelElement GHCJS.DOM.HTMLLegendElement GHCJS.DOM.HTMLLIElement GHCJS.DOM.HTMLLinkElement GHCJS.DOM.HTMLMapElement GHCJS.DOM.HTMLMenuElement GHCJS.DOM.HTMLMetaElement GHCJS.DOM.HTMLModElement GHCJS.DOM.HTMLObjectElement GHCJS.DOM.HTMLOListElement GHCJS.DOM.HTMLOptGroupElement GHCJS.DOM.HTMLOptionElement GHCJS.DOM.HTMLOptionsCollection GHCJS.DOM.HTMLParagraphElement GHCJS.DOM.HTMLParamElement GHCJS.DOM.HTMLPreElement GHCJS.DOM.HTMLQuoteElement GHCJS.DOM.HTMLScriptElement GHCJS.DOM.HTMLSelectElement GHCJS.DOM.HTMLStyleElement GHCJS.DOM.HTMLTableCaptionElement GHCJS.DOM.HTMLTableCellElement GHCJS.DOM.HTMLTableColElement GHCJS.DOM.HTMLTableElement GHCJS.DOM.HTMLTableRowElement GHCJS.DOM.HTMLTableSectionElement GHCJS.DOM.HTMLTextAreaElement GHCJS.DOM.HTMLTitleElement GHCJS.DOM.HTMLUListElement GHCJS.DOM.KeyboardEvent GHCJS.DOM.Location GHCJS.DOM.MediaList GHCJS.DOM.MediaQueryList GHCJS.DOM.MouseEvent GHCJS.DOM.NamedNodeMap GHCJS.DOM.Navigator GHCJS.DOM.Node GHCJS.DOM.NodeFilter GHCJS.DOM.NodeIterator GHCJS.DOM.NodeList GHCJS.DOM.ProcessingInstruction GHCJS.DOM.Range GHCJS.DOM.Ranges GHCJS.DOM.Screen GHCJS.DOM.StyleMedia GHCJS.DOM.StyleSheet GHCJS.DOM.StyleSheetList GHCJS.DOM.Stylesheets GHCJS.DOM.Storage GHCJS.DOM.Text GHCJS.DOM.Traversal GHCJS.DOM.TreeWalker GHCJS.DOM.UIEvent GHCJS.DOM.ValidityState GHCJS.DOM.WebKitNamedFlow GHCJS.DOM.WebKitPoint GHCJS.DOM.XPathExpression GHCJS.DOM.XPathNSResolver GHCJS.DOM.XPathResult GHCJS.DOM.DOMSecurityPolicy GHCJS.DOM.DOMStringList GHCJS.DOM.Geolocation GHCJS.DOM.HTMLCanvasElement GHCJS.DOM.HTMLDetailsElement GHCJS.DOM.HTMLEmbedElement GHCJS.DOM.HTMLKeygenElement GHCJS.DOM.HTMLMarqueeElement GHCJS.DOM.HTMLMediaElement GHCJS.DOM.HTMLVideoElement GHCJS.DOM.MediaError GHCJS.DOM.StorageInfo GHCJS.DOM.TimeRanges
src/GHCJS/DOM.hs:3:14: Unsupported extension: JavaScriptFFI
Failed to install ghcjs-dom-0.0.7
World file is already up to date.
cabal: Error: some packages failed to install:
ghcjs-dom-0.0.7 failed during the building phase. The exception was:
ExitFailure 1
My config:
$ cabal --version
cabal-install version 1.20.0.2
using version 1.20.0.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
Some patches seem to exist for GHC 7.8, but don't know how to use them.
ghcjs-dom is not designed to be installed with ghc, it is designed to be installed with ghc-js. To install packages for ghc-js, you need to run cabal install --ghcjs packageName
I noticed in the error messages that "c2hs" can't be found. This is often caused by not having ~/.cabal/bin in your path. Try typing "c2hs" at the prompt, this will tell you if it is set up.

Resources