building Python: up arrow broken on SuSE Linux 8.2

Discussion in 'Python' started by Erik Johnson, Jan 25, 2005.

  1. Erik Johnson

    Erik Johnson Guest

    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
     
    Erik Johnson, Jan 25, 2005
    #1
    1. Advertising

  2. Erik Johnson

    Peter Maas Guest

    Erik Johnson schrieb:
    > 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)?

    --
    -------------------------------------------------------------------
    Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
    E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
    -------------------------------------------------------------------
     
    Peter Maas, Jan 26, 2005
    #2
    1. Advertising

  3. Erik Johnson

    Erik Johnson Guest


    > 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" <>
    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 Johnson schrieb:
    > > 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".)

    >
    >
    > --
    > -------------------------------------------------------------------
    > Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
    > E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
    > -------------------------------------------------------------------
     
    Erik Johnson, Jan 27, 2005
    #3
  4. Erik Johnson

    Erik Johnson Guest

    "Erik Johnson" <> wrote in message
    news:...
    > 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.)
     
    Erik Johnson, Jan 27, 2005
    #4
  5. Erik Johnson

    Peter Otten Guest

    Erik Johnson wrote:

    > 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
     
    Peter Otten, Jan 27, 2005
    #5
  6. Erik Johnson

    Erik Johnson Guest

    "Peter Otten" <> wrote...
    > 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
     
    Erik Johnson, Jan 27, 2005
    #6
  7. Erik Johnson

    Peter Otten Guest

    Erik Johnson wrote:

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

    >
    > 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
     
    Peter Otten, Jan 28, 2005
    #7
  8. Erik Johnson

    Erik Johnson Guest

    SUCCESS!

    ----- Original Message -----
    From: "Peter Otten" <>
    > 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! :)
     
    Erik Johnson, Jan 29, 2005
    #8
  9. Erik Johnson

    Peter Otten Guest

    Re: SUCCESS!

    Erik Johnson wrote:

    > 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
     
    Peter Otten, Feb 3, 2005
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Eisenmann

    Python 2.3.3 SuSE Linux RPMs available

    Simon Eisenmann, Apr 5, 2004, in forum: Python
    Replies:
    0
    Views:
    344
    Simon Eisenmann
    Apr 5, 2004
  2. Glenn R Williams
    Replies:
    0
    Views:
    435
    Glenn R Williams
    Aug 14, 2004
  3. Denis S. Otkidach

    sre is broken in SuSE 9.2

    Denis S. Otkidach, Feb 10, 2005, in forum: Python
    Replies:
    24
    Views:
    683
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Feb 13, 2005
  4. Skip Montanaro
    Replies:
    2
    Views:
    318
    88888 Dihedral
    Oct 7, 2012
  5. Ned Deily
    Replies:
    0
    Views:
    171
    Ned Deily
    Oct 6, 2012
Loading...

Share This Page