Subject: Re: x11/gtk2 doesn't build on Linux (SuSE 8.1)
To: Julio M. Merino Vidal <email@example.com>
From: Johnny C. Lam <jlam@NetBSD.org>
Date: 03/28/2005 14:14:57
Julio M. Merino Vidal wrote:
> On Mon, 2005-03-28 at 15:05 +0200, Torsten Harenberg wrote:
>>It's also empty here, but I've attached the whole file for you to compare.
>>Hope you see a difference which could explain the behaviour...
> [mail snipped because it is not much related to what I'm going to say]
> [CCing jlam@ because he may know the answer; this looks like a "problem"
> in buildlink3]
> I've isolated the problem: the compiler is picking libXft
> from /usr/X11R6/lib instead of the one in /usr/pkg/lib. Both are
> different, and the former lacks some functions required by pango,
> thus causing the failure you see.
> You can reproduce it by creating a test file (just an empty main
> function) and running:
> $ gcc test.c -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib `pkg-config --libs
> pangoxft pangox`
> Mysteriously, if you remove -Wl,-R from the command line (leaving -L)
> it works. I may be missing some details about that flag, though.
> This happens because -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib appear
> before the flags for /usr/pkg/lib. I can't reproduce this locally
> in any of my boxes because the X system in them is new enough to
> provide the required functions from Xft2.
This is a problem where the pkgsrc libXft and the X11R6 libXft probably
have the same major number. Buildlink will force the correctly
libraries to be used during linking, but at run-time, the shared
libraries are found by searching the run-time library search path in
order. In this case, since /usr/X11R6/lib appears before /usr/pkg/lib
in the rpath, it will be searched first.
I believe that there is very little that we can do here to fix this
problem without requiring differing major numbers for the shared
libraries between X11R6 and pkgsrc. The search path cannot be
guaranteed to be correct and can actually never be correct if the user
chooses to use the builtin versions of some libraries while using pkgsrc
versions of others. While buildlink could reorder the -Wl,-R flags,
it's not clear how to determine what the correct order should be.
-- Johnny Lam <jlam@NetBSD.org>