pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Fontconfig confusion
On Thu 24 Apr 2008 at 17:21:41 -0500, Jeremy C. Reed wrote:
> > /usr/pkg/bin/vim:
> > ...
> > -lfreetype.6 => /usr/pkg/lib/libfreetype.so.6
> > -lfontconfig.1 => /usr/pkg/lib/libfontconfig.so.1
> > ...
> > -lfreetype.9 => /usr/X11R6/lib/libfreetype.so.9
> > -lfontconfig.1 => /usr/X11R6/lib/libfontconfig.so.1
>
> Can you objdump -x on vim and its dependencies to track down what uses
> which? (grep for NEED)
$ objdump -x /usr/pkg/bin/vim|grep NEED
NEEDED libgtk-x11-2.0.so.0
NEEDED libgdk-x11-2.0.so.0
NEEDED libXi.so.6
NEEDED libatk-1.0.so.0
NEEDED libgdk_pixbuf-2.0.so.0
NEEDED libpangocairo-1.0.so.0
NEEDED libXrandr.so.2
NEEDED libXext.so.6
NEEDED libXcursor.so.1
NEEDED libXfixes.so.0
NEEDED libcairo.so.2
NEEDED libpangoft2-1.0.so.0
NEEDED libfontconfig.so.1 <---
NEEDED libfreetype.so.6 <---
NEEDED libz.so.1
NEEDED libpango-1.0.so.0
NEEDED libm.so.0
NEEDED libXrender.so.1
NEEDED libgobject-2.0.so.0
NEEDED libgmodule-2.0.so.0
NEEDED libglib-2.0.so.0
NEEDED libintl.so.0
NEEDED libXt.so.6
NEEDED libcurses.so.6
NEEDED libc.so.12
NEEDED libX11.so.6
NEEDED libSM.so.6
NEEDED libICE.so.6
RPATH /usr/X11R6/lib:/usr/pkg/lib
These results surprised me a bit, since I had already found out that vim
directly links with -lfontconfig and -lfreetype, probably due to some
.pc file telling that it should. So I was expecting that due to the
explicit X11R6 inclusion in the link search path that those were the
errant references to /usr/X11R6/lib/libfreetype.so.9, but instead it
refers to the correct /usr/pkg/lib/libfreetype.so.6 ...
(Aside: these major numbers seem wrong, how can the base version claim
to be 3 major releases newer than the pkgsrc version?)
However, if the libfontconfig.so.1 that it picks up is the X11R6 one,
that version depends on the X11R6 libfreetype.so.9. Given its RPATH with
X11R6 first, that makes sense. Then Vim itself already brings in the
other libfreetype.
(I could not find any reference to libfreetype.so.9 from any of the
other used libraries)
Then I traced why Vim links directly to libfreetype and libfontconfig,
even though it isn't in the Makefile.
The file auto/config.log determines these values (including both
libraries):
GTK_LIBNAME='-Wl,-R/usr/pkg/lib -R/usr/X11R6/lib -Wl,--rpath
-Wl,/usr/pkg/lib -Wl,-R/usr/X11R6/lib -L/usr/pkg/lib -L/usr/X11R6/lib
-lgtk-x11-2.0 -lgdk-x11-2.0 -lXi -latk-1.0 -lgdk_pixbuf-2.0
-lpangocairo-1.0 -lXrandr -lXext -lXcursor -lXfixes -lcairo
-lpangoft2-1.0 -lfontconfig -lfreetype -lz -lpango-1.0 -lm -lXrender
-lX11 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl '
GTK_LIBS='-Wl,-R/usr/pkg/lib -R/usr/X11R6/lib -Wl,--rpath
-Wl,/usr/pkg/lib -Wl,-R/usr/X11R6/lib -L/usr/pkg/lib -L/usr/X11R6/lib
-lgtk-x11-2.0 -lgdk-x11-2.0 -lXi -latk-1.0 -lgdk_pixbuf-2.0
-lpangocairo-1.0 -lXrandr -lXext -lXcursor -lXfixes -lcairo
-lpangoft2-1.0 -lfontconfig -lfreetype -lz -lpango-1.0 -lm -lXrender
-lX11 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl '
made from
GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
GTK_LIBNAME="$GTK_LIBS" plus possibly some later additions
Now I was under the impression that because libgtk-x11-2.0.so.0 already
has
NEEDED libfontconfig.so.1
NEEDED libfreetype.so.6
one doesn't have to specify that to the linker when linking the
application.
I tested that theory, by removing all occurrences of "-lfontconfig
-lfreetype" from the makefiles in Vims building directory, and forced a
relink.
The resulting vim linked, and ran, and ldd showed only 1 fontconfig and
1 freetype.
Looking at the fontconfig files, it seems some recursive inclusion of
libraries is going on, since gtk+-2.0.pc doesn't list libfreetype or
libfontconfig, but it does list gdk-${target}-2.0, and gdk-x11-2.0.pc
lists
Requires: gdk-pixbuf-2.0 pango pangocairo fontconfig xrandr xcursor
xfixes
and pangocairo.pc includes
Libs: -Wl,-R${libdir} -L${libdir} -lpangocairo-1.0 -Wl,-R/usr/pkg/lib
-L/usr/pkg/lib -lfontconfig -L/usr/pkg/lib -Wl,--rpath -Wl,/usr/pkg/lib
-lfreetype -lz
-lfreetype is listed in several other .pc files, and I don't expect all
of them to be direct dependencies.
So perhaps a thorough cleanup of .pc files of various packages needs to
be done. Maybe taking in account linking systems where shared libraries
do not pull in their prerequisites automatically (in which case they
must stay in the .pc file, for better or for worse).
Hopefully that will make the rather dense dependency DAG a bit cleaner.
> Later when NetBSD switches to X.org on pkgsrc as its main X11 this problem
> will be gone. But we should make sure it is correct for now also.
Side remark: I hope that when that happens, precompiled packages will be
available which together are a good match for the native X11 we have
now. I do tend to see X11 as almost-a-part-of-the-base-system.
> Jeremy C. Reed
-Olaf.
--
___ Olaf 'Rhialto' Seibert -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl -- Cetero censeo "authored" delendum esse.
Home |
Main Index |
Thread Index |
Old Index