[parted-devel] --as-needed linker option causes trouble with -lreadline/-ltermcap

Otavio Salvador otavio at debian.org
Sat Mar 28 16:06:17 UTC 2009


Jim Meyering <jim at meyering.net> writes:

> When testing for the readline library, this works fine:
>
>     echo 'char readline (); int main () { return readline (); }' > k.c
>     gcc k.c -lreadline -ltermcap
>
> but in order to work around portability problems years ago, gnulib's
> lib-ignore.m4 makes it so the linker uses the --as-needed option:
>
>     gcc k.c -Wl,--as-needed -lreadline -ltermcap
>
> and that fails on RHEL 5.3
> (with binutils-2.17.50.0.6-9.el5.x86_64 and gcc-4.1.2-44.el5.x86_64):
>
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `PC'
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetflag'
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetent'
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `UP'
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tputs'
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgoto'
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetnum'
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `BC'
>     /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetstr'
>     collect2: ld returned 1 exit status
>     [Exit 1]
>
> And that makes parted's configure script fail to detect readline,
> which in turn resulted in some test failures.
>
> I'll look into it more, eventually.

Do you belive it is a bug in binutils? I tested it in Debian and it
works fine here.

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the parted-devel mailing list