Hi,
When cross-compiling packages for Windows, we have two pkgconfig directories:
/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig - contains *.pc files for the cross-compiled dependencies /usr/lib{,64}/pkgconfig - contains *.pc files for native libraries
Basically we never want pkg-config to look at native libraries. When cross-compiling, it is always an error if a program tries to include native headers or link with native libraries.
But pkg-config currently always falls back on the native directory, which causes us a problem in the following situations:
(a) User meant to install cross-compiled libfoo, but forgot to, yet the native libfoo is installed.
More seriously:
(b) libfoo isn't available at all on Windows, but libfoo must be installed natively. The configure script will always pick up the native version in this case, and there is no way we can tell pkgconfig that libfoo doesn't exist.
The attached patch, written by Erik van Pienbroek, adds an environment variable (PKG_CONFIG_IGNORE_NATIVE=1) to allow pkg-config's undesirable fallback-to-native behaviour to be suppressed.
Rich.
On Wed, Jan 28, 2009 at 4:35 AM, Richard W.M. Jones rjones@redhat.com wrote:
Hi,
When cross-compiling packages for Windows, we have two pkgconfig directories:
/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig - contains *.pc files for the cross-compiled dependencies /usr/lib{,64}/pkgconfig - contains *.pc files for native libraries
Basically we never want pkg-config to look at native libraries. When cross-compiling, it is always an error if a program tries to include native headers or link with native libraries.
But pkg-config currently always falls back on the native directory, which causes us a problem in the following situations:
(a) User meant to install cross-compiled libfoo, but forgot to, yet the native libfoo is installed.
More seriously:
(b) libfoo isn't available at all on Windows, but libfoo must be installed natively. The configure script will always pick up the native version in this case, and there is no way we can tell pkgconfig that libfoo doesn't exist.
If you set PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig, does that also work? I believe that was the intention of this variable.
-- Dan
On Wed, Jan 28, 2009 at 03:33:39PM -0800, Dan Nicholson wrote:
If you set PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig, does that also work? I believe that was the intention of this variable.
Yes, I think that should work, and I'm not sure why we didn't see it before. Anyhow, I'll try it out later this week.
Thanks,
Rich.
On Wed, Jan 28, 2009 at 3:38 PM, Richard W.M. Jones rjones@redhat.com wrote:
On Wed, Jan 28, 2009 at 03:33:39PM -0800, Dan Nicholson wrote:
If you set PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig, does that also work? I believe that was the intention of this variable.
Yes, I think that should work, and I'm not sure why we didn't see it before. Anyhow, I'll try it out later this week.
Pretty easy to test. Assume you have foo.pc in /usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig and /usr/lib/pkgconfig.
$ PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig PKG_CONFIG_DEBUG_SPEW=1 pkg-config --print-errors --exists foo
That should give you any information you need to see. You can also make PKG_CONFIG_LIBDIR into a PATH like variable:
PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig:/usr/i686-pc-mingw/sys-root/mingw/share/pkgconfig
-- Dan
On Wed, Jan 28, 2009 at 03:42:23PM -0800, Dan Nicholson wrote:
On Wed, Jan 28, 2009 at 3:38 PM, Richard W.M. Jones rjones@redhat.com wrote:
On Wed, Jan 28, 2009 at 03:33:39PM -0800, Dan Nicholson wrote:
If you set PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig, does that also work? I believe that was the intention of this variable.
Yes, I think that should work, and I'm not sure why we didn't see it before. Anyhow, I'll try it out later this week.
Pretty easy to test. Assume you have foo.pc in /usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig and /usr/lib/pkgconfig.
$ PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig PKG_CONFIG_DEBUG_SPEW=1 pkg-config --print-errors --exists foo
That should give you any information you need to see. You can also make PKG_CONFIG_LIBDIR into a PATH like variable:
PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig:/usr/i686-pc-mingw/sys-root/mingw/share/pkgconfig
Yes, I confirmed this does work.
Rich.
Richard W.M. Jones wrote:
On Wed, Jan 28, 2009 at 03:42:23PM -0800, Dan Nicholson wrote:
On Wed, Jan 28, 2009 at 3:38 PM, Richard W.M. Jones rjones@redhat.com wrote:
On Wed, Jan 28, 2009 at 03:33:39PM -0800, Dan Nicholson wrote:
If you set PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig, does that also work? I believe that was the intention of this variable.
Yes, I think that should work, and I'm not sure why we didn't see it before. Anyhow, I'll try it out later this week.
Pretty easy to test. Assume you have foo.pc in /usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig and /usr/lib/pkgconfig.
$ PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig PKG_CONFIG_DEBUG_SPEW=1 pkg-config --print-errors --exists foo
That should give you any information you need to see. You can also make PKG_CONFIG_LIBDIR into a PATH like variable:
PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw/sys-root/mingw/lib/pkgconfig:/usr/i686-pc-mingw/sys-root/mingw/share/pkgconfig
Yes, I confirmed this does work.
you mean in this way?
Suggested patch is attached.
Rich.
Farkas and I came up with very similar patches, so I applied this.
Rich.
On Fri, Jan 30, 2009 at 09:38:39AM +0000, Richard W.M. Jones wrote:
Farkas and I came up with very similar patches, so I applied this.
Farkas? Levente I mean.
Rich.