Bug 112687

Summary: Can't compile a simple example using readline.
Product: [Retired] Red Hat Linux Reporter: Need Real Name <jimeno>
Component: readlineAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-12-29 19:36:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2003-12-28 06:01:23 UTC
Description of problem:

Failure to compile everytime readline is required.


Version-Release number of selected component (if applicable):

readline-4.3-5


How reproducible:

Completely reproducible in my pretty-much updated system.
The RPMs corresponding to most of the files usually required for
development (including readline and readline-devel) are installed.


Steps to Reproduce:

1.
Create a file with the name and content indicated by the next
step/item (i.e. 2.)

2.
$ cat tst-readline.c

#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
                                                                     
          
int main()
{
  char* prompt="PROMPT>";
                                                                     
          
  char*  linealeida;
                                                                     
          
  linealeida = readline(prompt);
                                                                     
          
  printf("\n%s\n", linealeida);
}
                                                                     
          
3.
$ gcc -lreadline tst-readline.c -o tst-readline

Actual results:

/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:    
  undefined reference to `tgetnum'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tgoto'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tgetflag'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `BC'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tputs'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `PC'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tgetent'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `UP'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libreadline.so:
undefined reference to `tgetstr'
collect2: ld returned 1 exit status


Expected results:

(a succesfull compilation and the file tst-readline created)

Additional info:

I'm a readline newbie, and therefore I might be missing something. If
so, please say how a simple readline example should be compiled. BTW,
I guess the problem might be asociated to readline not being correctly
linked againste either curses(terminfo) or termcap.
Thanks.

Comment 1 Need Real Name 2003-12-29 19:36:19 UTC
Add "-ltermcap" to gcc's command line.