Skip to contentSkip to conversation

Pull request for branch for-2011.02/pkg-config-fix

GIT PULL New Thomas Petazzoni 2 participants 3 messages Dec 28, 2010

lore
Share & tools
lore
#0 lore raw

The following changes since commit 6527001c9d42b95c76b7689ed8eeecd8d17740cd:
Peter Korsgaard (1):
php: fix gmp extension build after libgmp bump

are available in the git repository at:

git://git.busybox.net/~tpetazzoni/git/buildroot for-2011.02/pkg-config-fix

Thomas Petazzoni (1):
package: correct usage of PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH

 package/Makefile.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Thanks,

Signature · 1 line
Thomas Petazzoni
#1 lore raw

PATCH 1/1 package: correct usage of PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH

Our usage of PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH was incorrect. According to pkg-config's documentation:

PKG_CONFIG_PATH

A colon-separated (on Windows, semicolon-separated) list of directories to search for .pc files. The default directory will always be searched after searching the path; the default is libdir/pkgconfig:datadir/pkgconfig where libdir is the libdir where pkg-config and datadir is the datadir where pkg-config was installed.

PKG_CONFIG_LIBDIR

Replaces the default pkg-config search directory.

In TARGET_CONFIGURE_OPTS (used to build packages for the target), we were doing:

PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig:$(PKG_CONFIG_PATH)"

This is incorrect for two reasons:

* Adding $(PKG_CONFIG_PATH) to the PKG_CONFIG_PATH is useless, as PKG_CONFIG_PATH only *adds* new paths to the existing search paths.

* PKG_CONFIG_PATH keeps default path (/usr/lib/pkgconfig) in the search path, which is incorrect for target packages: we should only look in $(STAGING_DIR)/usr/lib/pkgconfig. Lionel was hit by an issue caused by this: while compiling packages for the target, it was looking at .pc files in /usr/lib/pkgconfig on his host machine.

So instead, we just use PKG_CONFIG_LIBDIR with
$(STAGING_DIR)/usr/lib/pkgconfig.

In HOST_CONFIGURE_OPTS (used to build packages for the host), we were doing:

   PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig"

But there's no real reason to use PKG_CONFIG_LIBDIR here: as we are compiling for the host, we may well have some interesting libraries in /usr/lib/pkgconfig. So searching through them after $(HOST_DIR)/usr/lib/pkgconfig sounds like the right thing to do.

---
 package/Makefile.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
package/Makefile.in +2 -2
index 71c8dbc..4f1f1e4 100644
@@ -219,7 +219,7 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
 		FCFLAGS="$(TARGET_FCFLAGS)" \
 		PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
-		PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig:$(PKG_CONFIG_PATH)" \
+		PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
 		PERLLIB="$(HOST_DIR)/usr/lib/perl" \
 		STAGING_DIR="$(STAGING_DIR)"
 
@@ -241,7 +241,7 @@ HOST_CONFIGURE_OPTS=PATH=$(HOST_PATH) \
 		PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
 		PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
-		PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig" \
+		PKG_CONFIG_PATH="$(HOST_DIR)/usr/lib/pkgconfig" \
 		PERLLIB="$(HOST_DIR)/usr/lib/perl" \
 		LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib:$(LD_LIBRARY_PATH)"
 
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 1/1 package: correct usage of PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Thomas> In TARGET_CONFIGURE_OPTS (used to build packages for the target), we Thomas> were doing:

Thomas> PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig:$(PKG_CONFIG_PATH)"

Thomas> This is incorrect for two reasons:

Thomas> * Adding $(PKG_CONFIG_PATH) to the PKG_CONFIG_PATH is useless, as
Thomas> PKG_CONFIG_PATH only *adds* new paths to the existing search paths.

Thomas> * PKG_CONFIG_PATH keeps default path (/usr/lib/pkgconfig) in the

 Thomas>    search path, which is incorrect for target packages: we should only
 Thomas>    look in $(STAGING_DIR)/usr/lib/pkgconfig. Lionel was hit by an
 Thomas>    issue caused by this: while compiling packages for the target, it
 Thomas>    was looking at .pc files in /usr/lib/pkgconfig on his host machine.

Hmm, but we compile a dedicated (host) pkg-config for this, where we have set --pc-path=staging, so none of this should be needed, right? (with the possible exception of ensuring PKG_CONFIG_PATH isn't set in the environment).

Thomas> PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig"

Thomas> But there's no real reason to use PKG_CONFIG_LIBDIR here: as we are Thomas> compiling for the host, we may well have some interesting libraries in Thomas> /usr/lib/pkgconfig. So searching through them after Thomas> $(HOST_DIR)/usr/lib/pkgconfig sounds like the right thing to do.

That seems wrong as our pkg-config looks in staging by default, and random host libraries shouldn't get picked up if that then breaks the build for people without those libs.

Signature · 1 line
Bye, Peter Korsgaard