Skip to content

GHC 6.4.2 won't build on Mac OS X

Problem I'm running Mac OS X Tiger (10.4.6) and trying to build GHC 6.4.2 (using GCC 4.0.1 and GHC 6.4.1) and I'm ran into a problem where certain constants (e.g., UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END) are not found, causing compilation to stop. The same issue occurred for at least one other user with GHC 6.5; unfortunately, I can't find the post again.

Solution? Tiger ships with a NetBSD partial version of the readline library in /usr. Unfortunately, this file lacks a lot of the functionality in the GNU readline and is not compatible enough.

To get around this: # Download and decompress the GNU readline library, v5.1 tarball (other version may work) # cd <readline source dir> # ./configure # make # sudo make install #Installs to /usr/lib/include and /usr/lib/bin # cd <GHC source dir> # export LDFLAGS=-L/usr/local/lib # tell linker to use GNU version of readline # export CPPFLAGS=-I/usr/local/include # tell compiler to use GNU version of readline # ./configure --disable-openal --disable-alut # Audio disabled because of unrealted bug # make # sudo make install

This should do it. Steps 7 and 8 could cause problems because the compile will look for ALL libraries in /usr/local before looking in /usr.

The compilation is successful and ghc and ghci run; however, Unfortunately, I won't be able to test the results for some time.

Follow-Up? It should be possible to detect the lack of readline through the configure process. The NetBSD bad readline.h file results in the following statements: <pre> checking for rl_erase_empty_line in -lreadline... no checking for rl_free_undo_list in -lreadline... no </pre>

The GNU readline 5.1 library results in the following statements: <pre> checking for rl_erase_empty_line in -lreadline... yes checking for rl_free_undo_list in -lreadline... yes </pre>

It may be possible to create a test in the configure file by looking at the platform and these two functions. Also, the platform-specific documentation could be updated.

Trac metadata
Trac field Value
Version 6.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information