September 2009 Archives

09.03.2009 18:27

Building libreadline on Snow Leopard (10.6)

More fun and games building stuff on OS X.

I like Snow Leopard. Really, I do. However there is pain involved in getting ipython to work properly. After the upgrade (on a fresh install of Leopard) I used the system python to install ipython:

# easy_install ipython

Initially everything looked good. Aside from the rather ominous "Leopard libedit detected." message on startup. Unfortunately once I started using it, problems quickly became apparent:

  • Cursor not returning to the correct location on the line when using up/down arrow to browse history.
  • No ctrl-r to search through history.
  • Other random weirdness.

Fortunately Patrick van Kouteren wrote an excellent article that got me headed in the right direction. Unfortunately, building the ipython-packaged readline failed miserably during the initial configure process. As always, config.log tells the tale:

configure:1883: gcc -isysroot /Developer/SDKs/MacOSX10.5.sdk 
  -arch i386 -arch ppc -arch x86_64 -arch ppc64 -DNEED_EXTERN_PC
  -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc
  -arch x86_64 -arch ppc64 conftest.c  >&5
ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status
ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status

Fortunately for my sanity, it looks like distutils no longer tries to force building of Universal binaries on the Mac but still this looked awfully similar.

Solution:

  1. Edit setup.py and comment out these lines:

    if distutils.util.get_platform().find('macosx-10.5') == 0:
        UNIVERSAL = '-isysroot /Developer/SDKs/MacOSX10.5.sdk ' + \
                    '-arch i386 -arch ppc -arch x86_64 -arch ppc64'
    
    
  2. Edit rl/build.sh and comment out these lines:

    export CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk 
      -arch i386 -arch ppc -arch x86_64 -arch ppc64'
    export LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk
      -arch i386 -arch ppc -arch x86_64 -arch ppc64'
    
    

Posted by Insyte | Permanent link