readline AWOL?

Jorge Almeida jjalmeida at gmail.com
Wed Nov 19 04:22:02 PST 2008


On Wed, 19 Nov 2008, Roger Oberholtzer wrote:

>>  	$ gcc readtest.c -lreadline -lhistory
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgetnum'
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgoto'
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgetflag'
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `BC'
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tputs'
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `PC'
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgetent'
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `UP'
>>  	/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../libreadline.so: undefined reference to `tgetstr'
>>  	collect2: ld returned 1 exit status
>>
>> This happens in FC5 but not in Gentoo. I suppose the former (which I
>> don't control) may have some problem. Back to learning readline, now.
>
> When making a library, it is possible to tell the library what other
> libraries it may need. Then the user need not specify them when
> compiling a program with that library. This is why, quite often, ldd
> lists libraries you did not specify and were not added by the compiler.
> This third method brought them in. On Gentoo, you might run
> 'ldd ./your_program' to see what libs it is using. Look if they also
> exist on Fedora. If so, try adding those as well.
>
That's it. I added "-lncurses" in FC5 and it compiled, and works.
Anyway, I use gentoo in my PC, the FC5 was just another box I tried just
in case the problem was with my gentoo. It wasn't, the problem was my
ignorance about the -l option of gcc.

Thanks.

Jorge



More information about the Linux-users mailing list