installation error: version 1.5.2 on Unix

Thomas A. Bryan tbryan at python.net
Fri Feb 4 22:01:49 EST 2000


On Fri, 4 Feb 2000, Yueqiang Huang wrote:

> I decided to give up yesterday and removed readline from my system,
> but I changed my mind when I saw your post today. I downloaded
> readline-4.0 from ftp prep.ai.mit.edu:/pub/gnu and py152.tar from
> python.org and did the following things:

Didn't you still have your Python source directory on your system?  If I
remember correctly, it contains a demo directory and a tools directory
with utilities such as freeze (for shipping python code to those without
python).  I think that freeze even needs the original source directory.

[...Yueqiang makes libreadline.a...]

> However, after step 4, I have the following things under the target  
> directory of my installation:

[..listing of directory showing
/auto/terra-06/wrk6/yueqiang/readline4.0/lib/libreadline.a...]

> Now I assume the installation of readline-4.0 is OK. Then I go on to
> install python-1.5.2

> I added the following lines after "#readline readline.c -lreadline -ltermcap"$
> 
> readline -I/auto/terra-06/wrk6/yueqiang/readline4.0/include -L/auto/terra-06/$

Oops!

That should be something like the following (explanation below):

readline readline.c \
  -I/auto/terra-06/wrk6/yueqiang/readline4.0/include \ 
  -L/auto/terra-06/wrk6/yueqiang/readline4.0/lib \
  -lreadline -ltermcap

You also missed something in the documentation:
"""editing the file Modules/Setup.  This file is initially
copied (when the toplevel Makefile makes Modules/Makefile for the
first time) from Setup.in; if it does not exist yet, make a copy
yourself.  Never edit Setup.in -- always edit Setup."""

Actually, when I'm just adding modules, I don't even edit Setup.  If you
create a module called Setup.local in the Modules directory, it will be
read after Setup is read.  Thus, it overrides whatever is in Setup.  In
this way, you'll be able to use the same Setup.local when Python-1.6 comes
out later this year.


[..making Python..]

> gcc   python.o \
>           ../libpython1.5.a -L/auto/terra-06/wrk6/yueqiang/readline4.0/lib -l$
> Undefined                       first referenced
>  symbol                             in file
> initreadline                        ../libpython1.5.a(config.o)
> ld: fatal: Symbol referencing errors. No output written to python
> *** Error code 1
> make: Fatal error: Command failed for target `link'
> Current working directory /auto/terra-06/wrk6/yueqiang/Python/Python-1.5.2/Mo$
> *** Error code 1
> make: Fatal error: Command failed for target `python'

[..grep showing initreadline() in readline.c...]

> No output. Note that the dir in step 10 is the source of readline-4.0.
> So initreadline() is NOT defined in the readline-4.0 distribution.

Yes.  That is correct.  I can now confidently diagnose the problem: simple
misunderstanding.  Python's readline.c does not provide any readline
capability itself.  It *exposes* functionality *provided by* libreadline
to Python.  (Use the source...see the comments at the begining of the
readline.c file.)  Thus, the line

readline readline.c -lreadline -ltermcap

means something like "build the readline module from readline.c, using the
functions provided by libreadline and libtermcap."  Simply append your -L
and -I flags so that it looks in the correct place for the library and
include files, and you'll have a nice interpreter with command line
editing. :)

> As you mentioned in your post, maybe the only way out is to hack up a
> version of readline.c for readline-4.0.

No.  I was thinking of a completely different problem.  You'll probably be
able to fix your problem by changing the line in your Setup file that
specifies the readline support.

> I really appreciate your willingness to help. Thanks a lot!

You're welcome.  I enjoy troubleshooting build problems.

except-for-the-hours-I-wasted-with-apache's-mod_ssl-ly yours
---Tom



More information about the Python-list mailing list