Can't install and use Cabal (Haskell) on CentOS Server - zlib-0.5.4.1 failed during the building phase - haskell

I'm trying to install a Haskell server which runs in Cabal on my server. When I configure a server normally to run this, I follow these instructions which we've refined - they work 100% every time on a blank rackspace cloud server.
yum update
yum install git
yum install vim
yum install ghc-zlib-devel.x86_64
wget http://www.haskell.org/ghc/dist/7.8.2/ghc-7.8.2-x86_64-unknown-linux-centos65.tar.xz
wget http://www.haskell.org/cabal/release/cabal-install-1.20.0.1/cabal-x86_64-unknown-linux.tar.gz
tar xvfJ ghc-7.8.2-x86_64-unknown-linux-centos65.tar.xz
tar -zxvf cabal-x86_64-unknown-linux.tar.gz
cd ghc-7.8.2
./configure
yum install gcc
./configure
make install
cd ../
git clone https://github.com/samheather/DSA-WAW.git
cd DSA-WAW/server
cp -r ../../cabal cabal
./cabal update
./cabal install cabal-install
./cabal sandbox init
cabal install
I can then simply navigate to the output folder and run the server.
However, on my dedicated server with iWeb, this does not work. The first majority of steps are fine, until it gets to './cabal install cabal-install', where it throws the following errors:
./cabal install cabal-install
Resolving dependencies...
Configuring network-2.5.0.0...
Configuring zlib-0.5.4.1...
Configuring Cabal-1.20.0.1...
Building zlib-0.5.4.1...
Failed to install zlib-0.5.4.1
Last 10 lines of the build log ( /root/.cabal/logs/zlib-0.5.4.1.log ):
Configuring zlib-0.5.4.1...
Building zlib-0.5.4.1...
Preprocessing library zlib-0.5.4.1...
hsc2hs: dist/build/Codec/Compression/Zlib/Stream_hsc_make: runProcess: runInteractiveProcess: exec: permission denied (Permission denied)
Failed to install network-2.5.0.0
Last 10 lines of the build log ( /root/.cabal/logs/network-2.5.0.0.log ):
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/tmp/network-2.5.0.0-4813/network-2.5.0.0':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Failed to install Cabal-1.20.0.1
Last 10 lines of the build log ( /root/.cabal/logs/Cabal-1.20.0.1.log ):
[68 of 76] Compiling Distribution.Simple.Build ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/Distribution/Simple/Build.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Distribution/Simple/Build.o )
[69 of 76] Compiling Distribution.Simple.Haddock ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/Distribution/Simple/Haddock.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Distribution/Simple/Haddock.o )
[70 of 76] Compiling Distribution.Simple.SrcDist ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/Distribution/Simple/SrcDist.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Distribution/Simple/SrcDist.o )
[71 of 76] Compiling Distribution.Simple.UserHooks ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/Distribution/Simple/UserHooks.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Distribution/Simple/UserHooks.o )
[72 of 76] Compiling Distribution.Simple.Bench ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/Distribution/Simple/Bench.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Distribution/Simple/Bench.o )
[73 of 76] Compiling Distribution.Simple.Test.ExeV10 ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/Distribution/Simple/Test/ExeV10.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Distribution/Simple/Test/ExeV10.o )
[74 of 76] Compiling Distribution.Simple.Test ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/Distribution/Simple/Test.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Distribution/Simple/Test.o )
[75 of 76] Compiling Distribution.Simple ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/Distribution/Simple.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Distribution/Simple.o )
[76 of 76] Compiling Main ( /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/setup.hs, /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/Main.o )
Linking /tmp/Cabal-1.20.0.1-4813/Cabal-1.20.0.1/dist/setup/setup ...
cabal: Error: some packages failed to install:
Cabal-1.20.0.1 failed during the configure step. The exception was:
ExitFailure 127
HTTP-4000.2.17 depends on network-2.5.0.0 which failed to install.
cabal-install-1.20.0.3 depends on Cabal-1.20.0.1 which failed to install.
network-2.5.0.0 failed during the configure step. The exception was:
ExitFailure 1
zlib-0.5.4.1 failed during the building phase. The exception was:
ExitFailure 1
Does anyone have an idea what is going wrong with this?
Thanks,
Sam
Update: I should mention since the server already has gcc we skip these two steps: "yum install gcc; ./configure"

Install the zlib1g-dev package before.

Sam Heather's answer didn't work for me (i.e., removing the sticky bit from /tmp). Instead, I downloaded cabal v1.20.2 from Github and executed the bootstrap.sh script, see the README.

I just figured this out - my /tmp did not have exec permissions. Since the server runs WHM/cPanel, I just ran /scripts/securetmp, answering n to both.

I fixed similar errors with ghc-pkg recache which actually gets mentioned someplace in a failed build process, perhaps I'd reinstalled the Haskell platform with the same version.

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.

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.

Resources