Professional Web Applications Themes

readline problem [libreadline.so: undefined reference to...] - UNIX Programming

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: [rootdb:/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...

  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:

    [rootdb:/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. #2

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

    "Jason" <jake1138NO.SPAM.> 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:
    >
    > [rootdb:/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]ybergvcq.vasa.vg[/email]
    Maurizio Loreti Guest

  3. #3

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

    Maurizio Loreti <mlofoobar.it> wrote in message news:<rmy8z1u0pe.fsfmlinux.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

  4. #4

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

    "Maurizio Loreti" <mlofoobar.it> wrote in message
    news:rmy8z1u0pe.fsfmlinux.pd.infn.it...
    > "Jason" <jake1138NO.SPAM.> 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:
    > >
    > > [rootdb:/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]ybergvcq.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

  5. #5

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

    "Jason" <jake1138NO.SPAM.> wrote in message news:<bf0316$sk7$1terabinaries.xmission.com>...
    > And what FM would that be?
    This doesn't appear to be doented 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

Similar Threads

  1. undefined reference to 'boot_DynaLoader'
    By Karen in forum PERL Beginners
    Replies: 1
    Last Post: January 29th, 07:15 PM
  2. undefined reference to errno
    By Thomas Ronayne in forum Informix
    Replies: 2
    Last Post: October 13th, 11:29 PM
  3. #25538 [Opn->Csd]: undefined reference
    By carlo dot beccaria at sys-net dot it in forum PHP Development
    Replies: 0
    Last Post: September 15th, 08:44 AM
  4. #25538 [NEW]: undefined reference
    By carlo dot beccaria at sys-net dot it in forum PHP Development
    Replies: 0
    Last Post: September 15th, 08:10 AM
  5. libreadline problem on installation
    By Peter Grossi in forum Linux Setup, Configuration & Administration
    Replies: 0
    Last Post: June 26th, 03:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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