Bug 16095

Summary: should strip both /usr/lib and /usr/lib64 on multilib systems
Product: pkg-config Reporter: Colin Walters <walters>
Component: srcAssignee: Tollef Fog Heen <tfheen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: ohnobinki
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: exclude both /usr/lib and /usr/lib64
Rename subiter to system_dir_iter to match logic for header files
Add --with-system-include-path etc.

Description Colin Walters 2008-05-25 13:23:54 UTC
The current logic only strips one or the other.  See:

http://bugzilla.gnome.org/show_bug.cgi?id=528483
Comment 1 Colin Walters 2008-06-06 12:08:54 UTC
Created attachment 16969 [details] [review]
exclude both /usr/lib and /usr/lib64
Comment 2 Simon McVittie 2010-02-14 07:03:14 UTC
This is related to <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482884>. For multiarch support (at least on Debian), pkg-config should also strip anything the linker will search by default, notably:

* /usr/lib32 and /emul/ia32-linux/usr/lib on Debian amd64, powerpc

* "/usr/lib/TRIPLET for each architecture (where TRIPLET is like x86_64-linux-gnu or i486-freebsd), "including the non-default biarch and triarch directories"

The "non-default biarch and triarch directories" are non-trivial to determine, but appear to include at least:

* 64-bit versions of s390, sparc, i386, powerpc, mips and mipsel
* 32-bit versions of amd64, ppc64
* n32 versions of mips and mipsel
Comment 3 Simon McVittie 2010-02-14 09:34:57 UTC
I've prepared a branch which takes Colin's patch but also makes this more configurable, both at compile time and via environment variables.

Rationale: pkg-config upstream can't be expected to know what the system directories are for every OS in existence, but packagers for particular OS distributions (Debian is the one I'm interested in) can set the right system directories at compile time. The /usr/lib vs. /usr/lib64 thing is probably common enough, and easy enough to detect, to deserve a special case.

Git branch:

http://git.debian.org/?p=users/smcv/multiarch/pkg-config.git;a=shortlog;h=refs/heads/multiarch
Comment 4 Simon McVittie 2011-04-02 05:05:00 UTC
Created attachment 45161 [details] [review]
Rename subiter to system_dir_iter to match logic for header files

The name @subiter doesn't seem appropriate; it iterates over a separate
list, not over an item of @iter.

Also remove some trailing whitespace.
Comment 5 Simon McVittie 2011-04-02 05:05:49 UTC
Created attachment 45162 [details] [review]
Add --with-system-include-path etc.

Instead of hard-coding /usr/include, we now use the environment variable
PKG_CONFIG_SYSTEM_INCLUDE_PATH, defaulting to the argument of
./configure --with-system-include-path, which in turn defaults to
/usr/include.

Similarly, PKG_CONFIG_SYSTEM_LIBRARY_PATH defaults to /usr/lib or
/usr/lib:/usr/lib64 as appropriate.
 
(As currently implemented, this causes a behaviour change on Win32 -
the option -I/usr/include will now be filtered out.)

The intended usage is for Debian to configure pkg-config with
--with-system-include-path=/usr/include/$(DEB_HOST_GNU_TYPE):/usr/include
and the corresponding library path, for multiarch support
(<http://bugs.debian.org/482884>).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.