[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: --as-needed linker option causes trouble with -lreadline/-ltermcap
From: |
Ralf Wildenhues |
Subject: |
Re: --as-needed linker option causes trouble with -lreadline/-ltermcap |
Date: |
Sat, 28 Mar 2009 17:27:50 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
* 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