building Python: up arrow broken on SuSE Linux 8.2

E

Erik Johnson

I am trying to upgrade my Python installation. After downloading
sources and building Python 2.3.4, I am unable to use the command
history editing feature in the interactive interpreter (where the
up-arrow would previously give you the last command line to edit,
it now just prints "^[[A".) This is a feature I use often, and it
kinda nullifies that warm fuzzy feeling you get when things are
otherwise working as expected.

Python 2.2.2 was installed via YaST (standard SuSE distribution)
and works fine. Unfortunately, several modules I need are not part
of that installation and there doesn't seem to be a newer installation
via that route (that I know of). I downloaded source and built
Python 2.3.4 in my local directory. There were a lot of warnings like this:

Objects/intobject.c:1125: warning: comparison between signed and unsigned
Objects/intobject.c:1135: warning: comparison between signed and unsigned

I don't know exactly what "normal" output is, but things seem to
have gone pretty well, as this is the output after 'make test':

.... <snip>
test_zlib
226 tests OK.
29 tests skipped:
test_aepack test_al test_bsddb test_bsddb185 test_bsddb3 test_cd
test_cl test_curses test_dbm test_email_codecs test_gdbm test_gl
test_imgfile test_linuxaudiodev test_macfs test_macostools
test_nis test_normalization test_ossaudiodev test_pep277
test_plistlib test_scriptpackages test_socket_ssl
test_socketserver test_sunaudiodev test_timeout test_urllibnet
test_winreg test_winsound
3 skips unexpected on linux2:
test_dbm test_gdbm test_bsddb

(I'm not doing anything with DBM stuff, so I don't think I care about
the three skipped tests.)

I thought the problem may have had something to do with the
curses module, which is apparently not enabled by default. In the
Modules/Setup file, I changed this:

# First, look at Setup.config; configure may have set this for you.
#_curses _cursesmodule.c -lcurses -ltermcap
# Wrapper for the panel library that's part of ncurses and SYSV curses.
#_curses_panel _curses_panel.c -lpanel -lncurses

to this (my system has /usr/lib/libncurses.so.5.3):

# First, look at Setup.config; configure may have set this for you.
#_curses _cursesmodule.c -lcurses -ltermcap
_curses _cursesmodule.c -lncurses
# Wrapper for the panel library that's part of ncurses and SYSV curses.
#_curses_panel _curses_panel.c -lpanel -lncurses


I got a clean compile and the test_curses.py file executes silently:

sand:~/Python-2.3.4/Lib/test> ../../python ./test_curses.py
sand:~/Python-2.3.4/Lib/test>

Unfortunately, that didn't solve the problem.
Has anyone else seen this problem?
Or, more importantly, can someone tell me how to fix this?

Thanks for taking the time to read my post.

-ej
 
P

Peter Maas

Erik said:
I am trying to upgrade my Python installation. After downloading
sources and building Python 2.3.4, I am unable to use the command
history editing feature in the interactive interpreter (where the
up-arrow would previously give you the last command line to edit,
it now just prints "^[[A".)

Do you have the GNU readline library installed and within Python's
reach (lib in LD_LIBRARY_PATH or in /etc/ld.so.conf with subsequent
call of ldconfig)?
 
E

Erik Johnson

Do you have the GNU readline library installed and within Python's
reach (lib in LD_LIBRARY_PATH or in /etc/ld.so.conf with subsequent
call of ldconfig)?


I think you are on the right path. I later found an Apple article online
that answered essentially my question saying libreadline wasn't included on
the Apple Python distribution the OP was asking about. I now notice this in
the output of configure:

checking for rl_pre_input_hook in -lreadline... no
checking for rl_completion_matches in -lreadline... no


My system has /lib/libreadline.so.4.3. I guess it does not define
these newer functions and so that is why the readline module was not
configured in Setup to start with? That is the presumption I am working on.

So I downloaded & built libreadline version 5.0. I have libreadline.a
and shlib/libreadline.so.5.0 files. Having done Python & other scripting
languages for a while, I have sort of forgotten all the ugly details about C
compilation. I'm trying to figure out how to get Python2.3.4. statically
linked with the .a file and not muck with the system shared libraries and
let other applications fend for themselves. Any advice on how to statically
link in this library so the Python build is happy?

Thanks,
-ej



----- Original Message -----
From: "Peter Maas" <[email protected]>
Newsgroups: comp.lang.python
Sent: Wednesday, January 26, 2005 3:22 AM
Subject: Re: building Python: up arrow broken on SuSE Linux 8.2

Erik said:
I am trying to upgrade my Python installation. After downloading
sources and building Python 2.3.4, I am unable to use the command
history editing feature in the interactive interpreter (where the
up-arrow would previously give you the last command line to edit,
it now just prints "^[[A".)


--
 
E

Erik Johnson

Erik Johnson said:
So I downloaded & built libreadline version 5.0. I have libreadline.a
and shlib/libreadline.so.5.0 files. Having done Python & other scripting
languages for a while, I have sort of forgotten all the ugly details about C
compilation. I'm trying to figure out how to get Python2.3.4. statically
linked with the .a file and not muck with the system shared libraries and
let other applications fend for themselves. Any advice on how to statically
link in this library so the Python build is happy?

What I thought might be obvious and easy does not work, BTW...
In the Modules/Setup file I put this...

readline
readline.c -I/home/ej/readline-5.0 -L/home/ej/readline-5.0 -lreadline

re-ran configure and tried the make again. No joy. :(
Now I remember why I ended up using things like Perl & Python in the first
place...


ej@sand:~/Python-2.3.4> make
gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototyp
es -I. -I./Include -DPy_BUILD_CORE -o Modules/config.o Modules/config.c
gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototyp
es -I. -I./Include -DPy_BUILD_CORE -DPYTHONPATH='":plat-linux2:lib-tk"' \
-DPREFIX='"/usr/local"' \
-DEXEC_PREFIX='"/usr/local"' \
-DVERSION='"2.3"' \
-DVPATH='""' \
-o Modules/getpath.o ./Modules/getpath.c
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
-I. -I./Include -DPy_BUILD_CORE -I/home/ej/readline-5.0 -c
../Modules/readline.c -o Modules/readline.o
Modules/readline.c:26:31: readline/readline.h: No such file or directory
Modules/readline.c:27:30: readline/history.h: No such file or directory
Modules/readline.c: In function `parse_and_bind':
Modules/readline.c:49: warning: implicit declaration of function
`rl_parse_and_bind'
Modules/readline.c: In function `read_init_file':
Modules/readline.c:68: warning: implicit declaration of function
`rl_read_init_file'
Modules/readline.c: In function `read_history_file':
Modules/readline.c:89: warning: implicit declaration of function
`read_history'
Modules/readline.c: In function `write_history_file':
Modules/readline.c:111: warning: implicit declaration of function
`write_history'
Modules/readline.c:113: warning: implicit declaration of function
`history_truncate_file'
Modules/readline.c: In function `set_completer_delims':
Modules/readline.c:287: error: `rl_completer_word_break_characters'
undeclared (first use in this function)
Modules/readline.c:287: error: (Each undeclared identifier is reported only
once
Modules/readline.c:287: error: for each function it appears in.)
 
P

Peter Otten

Erik said:
the Apple Python distribution the OP was asking about.  I now notice this
in the output of configure:

checking for rl_pre_input_hook in -lreadline... no
checking for rl_completion_matches in -lreadline... no


My system has /lib/libreadline.so.4.3.   I guess it does not define
these newer functions and so that is why the readline module was not
configured in Setup to start with? That is the presumption I am working
on.

Have you ensured (with yast) that readline-devel is actually installed?

Peter
 
E

Erik Johnson

Peter Otten said:
Have you ensured (with yast) that readline-devel is actually installed?

I had not previously, but (not surprisingly) version 4.3 is installed. :)

Good idea - I thought maybe I would be able to do an online update (YOU)
to it, but it is taking forever to get a patch list. I don't understand it,
we have a pretty decent internet connection (DSL).

I now have the readline version 5.0 library built locally. Can someone
give me some clues about how to get it statically linked?

Thanks,
-ej
 
P

Peter Otten

Erik said:
I had not previously, but (not surprisingly) version 4.3 is installed. :)

According to http://cnswww.cns.cwru.edu/php/chet/readline/CHANGES the
features you missed were introduced in readline 4.0 and 4.2, so version 4.3
should be sufficient. So let me ask you again, you have both the readline
and the readline-devel package installed? If yes, and configure still
complains, it may be time to look for something entirely different...

Peter
 
E

Erik Johnson

----- Original Message -----
From: "Peter Otten said:
According to http://cnswww.cns.cwru.edu/php/chet/readline/CHANGES the
features you missed were introduced in readline 4.0 and 4.2, so version 4.3
should be sufficient. So let me ask you again, you have both the readline
and the readline-devel package installed? If yes, and configure still
complains, it may be time to look for something entirely different...


Sorry! Sorry! I made a mistake - I went and checked whether readline was
installed and not readline-devel.
I installed readline-devel. (Thank you for re-asking that question.)

Interestingly, configure *still* says...
ej@sand:~/Python-2.3.4> ./configure | grep readline
checking for rl_pre_input_hook in -lreadline... no
checking for rl_completion_matches in -lreadline... no

And the readline module is still not configured by default:
#readline readline.c -lreadline -ltermcap


But... if I change the line (in Modules/Setup) above to:
readline readline.c -lreadline

I get a clean compile and my up-arrow is now fixed!
Thank you so much for your help, Peter! :)

I don't know how to look at what is in a .so file, and I'm not clear on
whether /usr/lib/libreadline.a and the /usr/include/readline headers existed
prior to installing readline-devel or not (I would guess not), but it would
seem that version 4.3 definitely *should* be sufficient (as you pointed
out).
ej@sand:/usr/lib> ls *readline*
libguilereadline-v-12.a libguilereadline-v-12.so.12 libreadline.so
libguilereadline-v-12.la libguilereadline-v-12.so.12.3.0
libguilereadline-v-12.so libreadline.a
ej@sand:/usr/lib> nm libreadline.a | grep letion_match
000008d0 t gen_completion_matches
00001c60 T rl_completion_matches
00000070 T completion_matches
U rl_completion_matches
ej@sand:/usr/lib> nm libreadline.a | grep input_hook
00000030 B rl_pre_input_hook
ej@sand:/usr/lib> cd /usr/include/readline/
ej@sand:/usr/include/readline> ls
chardefs.h keymaps.h rlconf.h rltypedefs.h
history.h readline.h rlstdc.h tilde.h
ej@sand:/usr/include/readline> grep input_hook *
readline.h:extern rl_hook_func_t *rl_pre_input_hook;
ej@sand:/usr/include/readline> grep rl_completion_matches *
readline.h:extern char **rl_completion_matches PARAMS((const char *,
rl_compentry_func_t *));

So, there still seems to be a misbehaviour in the configure script. I'm
sure there must be other people on similar systems that would like to just
type:
../configure
make
make install

and be done with it, running v2.3.4 (or other?) with command line editing
working!
Looks like a bug worth reporting, yeah?

Thanks again for your help! :)
 
P

Peter Otten

Erik said:
I installed readline-devel. (Thank you for re-asking that question.)

I had that hunch :)
Interestingly, configure *still* says...
ej@sand:~/Python-2.3.4> ./configure | grep readline
checking for rl_pre_input_hook in -lreadline... no
checking for rl_completion_matches in -lreadline... no

I get similar messages for Python 2.4 on Suse 9.1, but the history *does*
work by default. Maybe if you start with a newly unzipped copy and
do ./configure it will work for you, too? Pardon me for not digging deeper
into the gory details...
Thanks again for your help! :)

You're welcome.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top