You (kmccarty@Princeton.EDU) wrote:
KBM> Most of these are X-related, suggesting that quite a lot of .la
KBM> and .pc files are pretty indiscriminate about which X libs they
KBM> link in.
Will this problem disappear if end programs will pass --as-needed flag
to the ld command line?

Some of it is also pkg-config's fault. For example, anyone using
pkg-config with gtk+2 gets the following:
# pkg-config --libs gtk+-2.0
-L/usr/X11R6/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -lXrandr -lXi -lXinerama
-lXext -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig
-lXcursor -lpango-1.0 -lcairo -lXrender -lX11 -lgobject-2.0
-lgmodule-2.0 -ldl -lglib-2.0
Which is all crap. Yes, this is the list you need for static, but
pkg-config is recursing through modules even for dynamic linking which
is wrong. Now either pkg-config of the gtk+2 pc file needs to be
fixed, then you can start recompiling all the affected programs...
Some of the discussion in bug #340904 is relevent here.
Have a nice day,
--
Martijn van Oosterhout <kleptog@gmail.com> http://svana.org/kleptog/