Search code examples
haskellcentoszlibcabalcabal-install

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


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"


Solution

  • 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.