readline problem [libreadline.so: undefined reference to...]

Ask a Question related to UNIX Programming, Design and Development.

  1. #1

    Default readline problem [libreadline.so: undefined reference to...]

    I'm running RedHat 7.1 and I can't get the readline author's example program
    to compile (nor any other readline-using program). Any suggestions? Here
    are the error messages:

    [root@db:/home/jake/weber/unix/readline-example]$ gcc -lreadline rl.c
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `tgetnum'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `tgoto'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `tgetflag'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `BC'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `tputs'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `PC'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `tgetent'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `UP'
    /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    reference to `tgetstr'
    collect2: ld returned 1 exit status


    Jason Guest

  2. Similar Questions and Discussions

    1. undefined reference to 'boot_DynaLoader'
      Hi, I tried embedding perl into C, and inserted these coz i had an error prior to this one...
    2. undefined reference to errno
      I've upgraded to Slackware 9.1, which includes gcc-3.2.3, and I'm having problems linking (in this case) Art Kagel's utils2_ak programs with...
    3. #25538 [Csd->Bgs]: undefined reference
      ID: 25538 Updated by: sniper@php.net Reported By: carlo dot beccaria at sys-net dot it -Status: Closed...
    4. #25538 [NEW]: undefined reference
      From: carlo dot beccaria at sys-net dot it Operating system: linux PHP version: 5CVS-2003-09-15 (dev) PHP Bug Type: *Compile...
    5. libreadline problem on installation
      Hi I am trying to install samba 2.2.4-2 under RedHat Linux 7.2 (I need compatibliity with other installations). It compliains that there is no...
  3. #2

    Default Re: readline problem [libreadline.so: undefined reference to...]

    "Jason" <jake1138@NO.SPAM.yahoo.com> writes:
    > I'm running RedHat 7.1 and I can't get the readline author's example program
    > to compile (nor any other readline-using program). Any suggestions? Here
    > are the error messages:
    >
    > [root@db:/home/jake/weber/unix/readline-example]$ gcc -lreadline rl.c
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `tgetnum'
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `tgoto'
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `tgetflag'
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `BC'
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `tputs'
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `PC'
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `tgetent'
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `UP'
    > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so: undefined
    > reference to `tgetstr'
    > collect2: ld returned 1 exit status
    RTFM. gcc -lreadline -termcap rl.c

    --
    Maurizio Loreti [url]http://www.pd.infn.it/~loreti/mlo.html[/url]
    Dept. of Physics, Univ. of Padova, Italy ROT13: [email]ybergv@cq.vasa.vg[/email]
    Maurizio Loreti Guest

  4. #3

    Default Re: readline problem [libreadline.so: undefined reference to...]

    Maurizio Loreti <mlo@foobar.it> wrote in message news:<rmy8z1u0pe.fsf@mlinux.pd.infn.it>...
    > gcc -lreadline -termcap rl.c
    Better make that "gcc rl.c -lreadline -ltermcap".
    The order of sources and libraries matters, and so does spelling.

    Cheers,
    Paul Pluzhnikov Guest

  5. #4

    Default Re: readline problem [libreadline.so: undefined reference to...]

    "Maurizio Loreti" <mlo@foobar.it> wrote in message
    news:rmy8z1u0pe.fsf@mlinux.pd.infn.it...
    > "Jason" <jake1138@NO.SPAM.yahoo.com> writes:
    >
    > > I'm running RedHat 7.1 and I can't get the readline author's example
    program
    > > to compile (nor any other readline-using program). Any suggestions?
    Here
    > > are the error messages:
    > >
    > > [root@db:/home/jake/weber/unix/readline-example]$ gcc -lreadline rl.c
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `tgetnum'
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `tgoto'
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `tgetflag'
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `BC'
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `tputs'
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `PC'
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `tgetent'
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `UP'
    > > /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../libreadline.so:
    undefined
    > > reference to `tgetstr'
    > > collect2: ld returned 1 exit status
    >
    > RTFM. gcc -lreadline -termcap rl.c
    >
    > --
    > Maurizio Loreti
    [url]http://www.pd.infn.it/~loreti/mlo.html[/url]
    > Dept. of Physics, Univ. of Padova, Italy ROT13:
    [email]ybergv@cq.vasa.vg[/email]

    And what FM would that be?

    I can compile this just fine on a Debian system with just -lreadline, but
    not on either of the RedHat systems that I've tried. I can add -ltermcap
    or -lncurses and either one will allow it to compile though. Anyone care to
    shed some light on why? What does readline have to do with termcap or
    ncurses? By the way, thanks for your responses.

    --
    Jason
    [ jake1138 AT yahoo DOT com ]


    Jason Guest

  6. #5

    Default Re: readline problem [libreadline.so: undefined reference to...]

    "Jason" <jake1138@NO.SPAM.yahoo.com> wrote in message news:<bf0316$sk7$1@terabinaries.xmission.com>...
    > And what FM would that be?
    This doesn't appear to be documented in the info pages ;-(

    You could have figured it out, though:

    $ nm -AD /usr/lib/lib*.so 2>/dev/null | grep ' tgetnum'
    /usr/lib/libcurses.so:00029140 T tgetnum
    /usr/lib/libncurses.so:00029140 T tgetnum
    /usr/lib/libreadline.so: U tgetnum
    /usr/lib/libtermcap.so:00001e60 T tgetnum
    > I can compile this just fine on a Debian system with just -lreadline, but
    > not on either of the RedHat systems that I've tried. I can add -ltermcap
    > or -lncurses and either one will allow it to compile though. Anyone care to
    > shed some light on why?
    Probably because libreadline.so on Debian has a dynamic dependency on
    libtermcap.so or libncurses.so, while on RedHat it doesn't.

    Run "ldd your_exe" to find which libreadline.so it uses, then
    "ldd /path/to/libreadline.so" on both systems, and compare the results.
    > What does readline have to do with termcap or ncurses?
    It needs to redraw your screen (well, just the line on which you are typing),
    and position your cursor. That's precisely what lib{curses,termcap} do.
    Typing "info termcap" will tell you more.

    Cheers,
    Paul Pluzhnikov Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139