Subject: pkg/34108: Wrong rpath order in BUILDLINK_LDFLAGS
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <minskim@NetBSD.org>
List: pkgsrc-bugs
Date: 07/29/2006 04:15:01
>Number:         34108
>Category:       pkg
>Synopsis:       Wrong rpath order in BUILDLINK_LDFLAGS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 29 04:15:00 +0000 2006
>Originator:     Min Sik Kim
>Release:        pkgsrc-current
>Organization:
>Environment:
	Linux 2.6.12-10-amd64-xeon
>Description:
After adding LIBABISUFFIX for amd64 in mk/platform/Linux.mk, packages are
linked against native libraries instead of pkgsrc ones.

% cd textproc/libxml2
% bmake show-var VARNAME=PREFIX
/home/msk/pkg
% bmake show-var PKG_PHASE=build VARNAME=BUILDLINK_LDFLAGS -L/usr/lib64 -Wl,-R/usr/lib64 -Wl,-R/home/msk/pkg/lib
% bmake install
% ldd /home/msk/pkg/bin/xmlcatalog
       libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002aaaaabc3000)
       libdl.so.2 => /lib/libdl.so.2 (0x00002aaaaadfe000)
       libz.so.1 => /usr/lib64/libz.so.1 (0x00002aaaaaf02000)
       libm.so.6 => /lib/libm.so.6 (0x00002aaaab018000)
       libc.so.6 => /lib/libc.so.6 (0x00002aaaab19e000)
       /lib64/ld-linux-x86-64.so.2 (0x00002aaaaaaab000)

Because of /usr/lib64 in BUILDLINK_LDFLAGS, xmlcatalog (installeld by
libxml2) uses /usr/lib64/libxml2.so.2 instead of
${PREFIX}/libxml2.so.2, and /usr/lib64/libz.so.1 instead of
${PREFIX}/libz.so.1.

>How-To-Repeat:
Build a package depending on a pkgsrc library of which an older,
incompatible version is in /usr/lib64.

>Fix:
Change the order in BUILDLINK_LDFLAGS so that ${PREFIX}/lib always
preceds /usr/lib64.