Error installing Haskell X11 libs

I recently bought a new Macbook Pro and with the recent announcment of GHC 6.10.1, I thought it was time to install the latest GHC and libs. Previously I had some trouble installing the Haskell X11 libs on Leopard, but I thought something might have been borked on my old laptop. With this new one and starting from scratch, I hoped things would go smoothly. Twas not to be.

The X11 libraries are installed under /usr/X11/lib.

bash-3.2$ locate libX11
/Applications/CrossOver Games.app/Contents/SharedSupport/X11/lib/libX11.6.2.dylib
/Applications/CrossOver Games.app/Contents/SharedSupport/X11/lib/libX11.6.dylib
/Applications/CrossOver Games.app/Contents/SharedSupport/X11/lib/libX11.dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib/libX11.6.2.dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib/libX11.6.dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib/libX11.a
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib/libX11.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/libX11.6.2.0.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/libX11.6.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/X11/lib/libX11.dylib
/opt/local/var/macports/sources/rsync.macports.org/release/ports/x11/xorg-libX11
/opt/local/var/macports/sources/rsync.macports.org/release/ports/x11/xorg-libX11/Portfile
/usr/X11/lib/libX11.6.2.0.dylib
/usr/X11/lib/libX11.6.dylib
/usr/X11/lib/libX11.dylib
/usr/X11/lib/libX11.la

I've fallen down and I can't get up

Here are some things I tried that didn't work.

  • Try adding an entry for extra-lib-dirs to X11.cabal
  • A FAQ entry for XMonad offers up some helpful tips to try.

    extra-lib-dirs:     /usr/X11/lib
    
    

    and try to configure ...

    bash-3.2$ runhaskell Setup.hs configure
    
    checking for X... no
    configure: error: X11 libraries not found, so X11 package cannot be built
    See `config.log' for more details.
    
    

  • Try passing option to configure
  • bash-3.2$ runhaskell Setup.hs configure --extra-lib-dirs=/usr/X11/lib
    
    checking for X... no
    configure: error: X11 libraries not found, so X11 package cannot be built
    See `config.log' for more details.
    
    

  • Try setting LD_LIBRARY_PATH
  • bash-3.2$ export LD_LIBRARY_PATH=/usr/X11/lib; runhaskell Setup.hs configure
    
    checking for X... no
    configure: error: X11 libraries not found, so X11 package cannot be built
    See `config.log' for more details.
    
    

  • Try setting DYLD_LIBRARY_PATH
  • bash-3.2$ export DYLD_LIBRARY_PATH=/usr/X11/lib; runhaskell Setup.hs configure
    
    checking for X... no
    configure: error: X11 libraries not found, so X11 package cannot be built
    See `config.log' for more details.
    
    

  • Try setting DYLD_FALLBACK_LIBRARY_PATH
  • bash-3.2$ export DYLD_LIBRARY_PATH=/usr/X11/lib
    bash-3.2$ runhaskell Setup.hs configure
    
    Setup.hs:3:0:
        Warning: In the use of `defaultUserHooks'
                 (imported from Distribution.Simple):
                 Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
                 compatibility in which case you must stick with defaultUserHooks"
    Setup.hs: <command line>: can't load .so/.DLL for: dl (dlopen(libdl.dylib, 9): image not found)
    
    

It's a bit disappointing how different OSX is from the Linux distros. Yeah it doesn't suck like Windows, but even so I wish it weren't so different from Linux.

So what did work?

Just like in my previous article, using the LDFLAGS variable solves the problem.

bash-3.2$ export LDFLAGS=-L/usr/X11/lib; runhaskell Setup.hs configure

Setup.hs:3:0:
    Warning: In the use of `defaultUserHooks'
             (imported from Distribution.Simple):
             Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
             compatibility in which case you must stick with defaultUserHooks"
Warning: defaultUserHooks in Setup script is deprecated.
Configuring X11-1.4.4...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for X... libraries , headers 
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking whether to build Xinerama... yes
checking for egrep... grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking X11/extensions/Xinerama.h usability... yes
checking X11/extensions/Xinerama.h presence... yes
checking for X11/extensions/Xinerama.h... yes
configure: creating ./config.status
config.status: creating config.mk
config.status: creating X11.buildinfo
config.status: creating include/HsX11Config.h
config.status: creating include/X11_extras_config.h

tags: haskell, osx, x11

Comments

comments powered by Disqus