Doug's musings
<< Going loopy 2003 > August Remember Shakti >>

Sunday, 31 August 2003

Building gnu readline 4.3 on Mac OS X ::

Building a shared library version of gnu readline (e.g. for Python) on Mac OS X requires jumping through a little hoop, and most annoyingly, I’ve jumped through it several times over the last couple of years. Here’s the trick (for gcc 3.3 anyhow).

In the file support/shobj-conf, find this section:

darwin*|macosx*)
        SHOBJ_STATUS=unsupported
        SHLIB_STATUS=supported
          
        SHOBJ_CFLAGS='-fno-common -dynamic'

        SHOBJ_LD=/usr/bin/libtool
        
        SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
        SHLIB_LIBSUFF='dylib'
        
        SHOBJ_LDFLAGS='-dynamic'
        SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
        
        SHLIB_LIBS='-lSystem'

Change the last line to:

        SHLIB_LIBS='-lSystem -lcurses -lgcc'

Then rerun configure and make install. Now for Python 2.3, do the same. Python’s configure script will notice the presence of the readline shared library and Do The Right Thing.

Added, 2 Sep: libcurses defines a bunch of otherwise missing symbols including _tgetent. libgcc defines saveFP and restoreFP.

Sun, 31 Aug 2003, 12:11 PDT

References:
More on building readline (21 January 2004)

<< Going loopy 2003 > August Remember Shakti >>