Bug 16095 - should strip both /usr/lib and /usr/lib64 on multilib systems
Summary: should strip both /usr/lib and /usr/lib64 on multilib systems
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Tollef Fog Heen
QA Contact:
Keywords: patch
Depends on:
Reported: 2008-05-25 13:23 UTC by Colin Walters
Modified: 2011-04-13 13:58 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

exclude both /usr/lib and /usr/lib64 (2.12 KB, patch)
2008-06-06 12:08 UTC, Colin Walters
Details | Splinter Review
Rename subiter to system_dir_iter to match logic for header files (1.80 KB, patch)
2011-04-02 05:05 UTC, Simon McVittie
Details | Splinter Review
Add --with-system-include-path etc. (5.10 KB, patch)
2011-04-02 05:05 UTC, Simon McVittie
Details | Splinter Review

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

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:

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

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
and the corresponding library path, for multiarch support

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.