Subject: Re: PKGCONFIG_OVERRIDE only for buildlinking (not for installed *.pc files)?
To: Jeremy C. Reed <firstname.lastname@example.org>
From: Greg Troxel <email@example.com>
Date: 03/03/2006 08:10:54
"Jeremy C. Reed" <firstname.lastname@example.org> writes:
> Here is an example:
> gcc -I/home/reed/xorg/include -I/home/reed/xorg/include
> -I/home/reed/pkg/include -I/home/reed/pkg/include/freetype2
> -I/home/reed/xorg/include -I/home/reed/xorg/include -g -O2 -o x11perf
> bitmaps.o do_arcs.o do_blt.o do_complex.o do_dots.o do_lines.o
> do_movewin.o do_rects.o do_segs.o do_simple.o do_tests.o do_text.o
> do_traps.o do_tris.o do_valgc.o do_windows.o x11perf.o
> -L/home/reed/xorg/lib -lXext -Wl,-R/home/reed/pkg/lib
> -L/home/reed/xorg/lib -L/home/reed/pkg/lib -lXft -lXrender -lfontconfig
> -lfreetype -lz -lX11 -L/home/reed/xorg/lib -lXrender -lX11
> -L/home/reed/xorg/lib -lXmuu -lX11 -lm
> The above fails for me, because the "-Wl,-R/home/reed/pkg/lib" which came
> from the pkg-config --libs xft. This causes the wrong and old libX11 to be
> used (causing an undefined reference).
It would help in the example to explain what prefixes are used for
what; I'm guessing /home/reed/pkg is the PREFIX for pkgsrc, and that
instead of /usr/pkg/xorg you are using /home/reed/xorg, but I'm not
confident. Or do you have an entirely separate pkgsrc installation
there with X11_TYPE=xorg.
Are you trying to use libraries built from pkgsrc but use dependencies
other than the ones they were built with? That seems at least
I agree with Thomas and believe that the .pc file installed by pkgsrc
should be sufficient for a random non-pkgsrc program to build against
the pkg libs by including the usual pkg-config invocations on the
command lines. So that pretty much requires -R in the libs line in
pc, unless we instead choose to teach pkg-config to output -R
automatically for all -L lines.
It would be cool if the linker could have a way to record RPATH for
particular libraries, instead of one global path. I suspect this is
really at the root of your problem.
> I want the above to use fontconfig and freetype as installed via pkgsrc
> (/home/reed/pkg/lib). And for all X libraries use my new versions
> (/home/reed/xorg/lib). Any ideas on how the above should be ordered? (I
> have tried a few different ways with no luck. The only way that does work
> for me is to remove the "-Wl,-R/home/reed/pkg/lib".)
If I understand (which I'm not sure I do), I think what you are doing
is wrong from the pkgsrc orthodoxy viewpoint - you are trying swap out
a library that you know is ABI compatible from the one the pkg was
Or, if you aren't trying to do that, you're perhaps losing because of
the global RPATH limitation where a library other than what the pkg
was built with is getting picked up.
> My workaround is to remove all the libraries and pc files for the
> identical software. But I prefer not having to do that. And I prefer not
> having two installations of pkgconfig, freetype2, fontconfig.
It might help to provide ldd output of the 'correct' and 'incorrect'
builds, and also a top-level ddescription of what you are trying to
do. I'm starting to move towards running xorg servers (915 chipset,
pci-e in 955, not sure about 945 chipset) and beginning to struggle
with this, and wonder if I'll run into the same issues. But so far
I'm inclined to use the server only, and not the client libs - to
avoid dealing with these issues.
Greg Troxel <email@example.com>