[parted-devel] --as-needed linker option causes trouble with -lreadline/-ltermcap
Ralf Wildenhues
Ralf.Wildenhues at gmx.de
Sat Mar 28 16:29:27 UTC 2009
* Ralf Wildenhues wrote on Sat, Mar 28, 2009 at 05:02:36PM CET:
> * Jim Meyering wrote on Sat, Mar 28, 2009 at 03:22:14PM CET:
> > gcc k.c -Wl,--as-needed -lreadline -ltermcap
> To work around it in the test, I suppose you can link a program
> that also requires a symbol from termcap.
Hmm. That may not be the best idea after all: in your source code,
you may not want to require a termcap symbol, and then your link
could fail for the same reason. You could try linking without
as-needed, with the known consequences for other libraries.
If readline happens to already be linked against ncurses, if I
understand things right, then adding a symbol from termcap and
using as-needed and -ltermcap, you might end up loading both
termcap and ncurses at run time. Yuck. I can't test this right
now, but IIRC then the linker works breadth-first.
Hmm.
Cheers,
Ralf
More information about the parted-devel
mailing list