compiling Python with readline

Erik Price pricee at hhbrown.com
Tue Apr 2 16:29:01 EST 2002


On Tuesday, April 2, 2002, at 02:25  PM, Geoff Gerrietts wrote:

> Quoting Erik Price (pricee at hhbrown.com):
>> Hello,
>>
>> Sorry to trouble if this is not the right list -- I would like to
>> re-compile my Python 2.2 source (on Mac OS X 10.1.3) to support 
>> readline
>> (or whatever it takes to get emacs-style key bindings to work in the
>> interpreter, like I get in bash).

> The Modules/Setup file is automatically created from (I believe)
> Modules/Setup.dist, but will not be overwritten if it exists.
>
> In other words, if you need to use a nondefault Setup file, cd into
> Modules, cp Setup.dist to Setup, and edit Setup.
>
> When I built 2.2, the configure process automatically discovered
> the existence of readline and built the interpreter properly. If you
> haven't tried that, you might consider trying it. If it doesn't work,
> you may have some configuration problems with the readline library (or
> you may not, but it's possible).
>
> Best of luck (if you need more help, feel free to ask).

Thanks for the reply, Geoff!  I found the Modules/Setup.dist file and 
copied it to Setup as per your instructions (and the instructions in the 
file).  I also found the following text in the file:

<quote source="Modules/Setup">
# GNU readline.  Unlike previous Python incarnations, GNU readline is
# now incorporated in an optional module, configured in the Setup file
# instead of by a configure script switch.  You may have to insert a
# -L option pointing to the directory where libreadline.* lives,
# and you may have to change -ltermcap to -ltermlib or perhaps remove
# it, depending on your system -- see the GNU readline instructions.
# It's okay for this to be a shared library, too.
</quote>

So I uncommented the line, but my 'make' command failed with the 
following error:

<quote source="make output">
cc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -no-cpp-precomp -I. 
-I./Include -DHAVE_CONFIG_H   -c ./Modules/readline.c -o 
Modules/readline.o
./Modules/readline.c:21: readline/readline.h: No such file or directory
./Modules/readline.c:22: readline/history.h: No such file or directory
make: *** [Modules/readline.o] Error 1
</quote>

I then rm'd the source tree and re-extracted (to avoid messing with 
config.cache and make clean), and tried adding the -L option described 
in the Modules/Setup script.  My syntax looks like this:

<quote source="Modules/Setup">
readline -L /sw/lib/ readline.c -lreadline -ltermcap
</quote>

But this time my ./configure failed.

My libreadline.* files are located in /sw/lib, they are 
/sw/lib/libreadline.4.dylib, /sw/lib/libreadline.a, and 
/sw/lib/libreadline.dylib.  I am guessing that I am giving the wrong 
syntax for the -L option.  Can anyone see what I'm doing wrong here?

Thank you for your time,


Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
pricee at hhbrown.com





More information about the Python-list mailing list