Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cabal doesn't work on Mac OS X Lion because of gcc path

Tags:

I just did a fresh installation of Mac OS X Lion, and installed Xcode 4.3 & Haskell platform 2011.4.0.0.

When I tried installing packages by Cabal, I got the following error:

cabal install cabal-install Resolving dependencies... Configuring cabal-install-0.10.2... ghc: could not execute: /Developer/usr/bin/gcc cabal: Error: some packages failed to install: cabal-install-0.10.2 failed during the configure step. The exception was: ExitFailure 1 

I found Xcode 4.3 is not installed in /Developer any longer. Actually, gcc can be found in /usr/bin.

I tried cabal install flag --with-gcc /usr/bin/gcc (and --with-gcc=/usr/bin/gcc). It doesn't work.

I tried to create a link of gcc in /Developer/usr/bin, but gcc complains it cannot find some files.

like image 544
Garriot Zhang Avatar asked Feb 22 '12 01:02

Garriot Zhang


1 Answers

I'm not using Lion, but if you do cat /usr/bin/ghc you will find that ghc is really a shell script which defines a variable for which gcc to use. I assume the obvious surgery will work. In any case mine looks like this, which wouldn't be right for you:

#!/bin/sh exedir="/Library/Frameworks/GHC.framework/Versions/7.0.4-i386/usr/lib/ghc-7.0.4" exeprog="ghc-stage2" executablename="$exedir/$exeprog" datadir="/Library/Frameworks/GHC.framework/Versions/7.0.4-i386/usr/share" bindir="/Library/Frameworks/GHC.framework/Versions/7.0.4-i386/usr/bin" topdir="/Library/Frameworks/GHC.framework/Versions/7.0.4-i386/usr/lib/ghc-7.0.4" pgmgcc="/Developer/usr/bin/gcc" executablename="$exedir/ghc" exec "$executablename" -B"$topdir" -pgmc "$pgmgcc" -pgma "$pgmgcc" -pgml "$pgmgcc" -pgmP "$pgmgcc -E -undef -traditional" -optl"-Wl,-read_only_relocs,suppress" ${1+"$@"} 
like image 137
applicative Avatar answered Oct 04 '22 04:10

applicative