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

Jim Meyering jim at meyering.net
Sat Mar 28 14:22:14 UTC 2009


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.



More information about the parted-devel mailing list