From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKkIn-0003uG-MT for qemu-devel@nongnu.org; Fri, 22 Aug 2014 04:34:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKkIj-0004CB-PG for qemu-devel@nongnu.org; Fri, 22 Aug 2014 04:34:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKkIj-0004C1-IC for qemu-devel@nongnu.org; Fri, 22 Aug 2014 04:34:25 -0400 Date: Fri, 22 Aug 2014 09:34:18 +0100 From: "Daniel P. Berrange" Message-ID: <20140822083418.GB8447@redhat.com> References: <53F55173.6070704@redhat.com> <20140821090328.GA32580@stefanha-thinkpad.redhat.com> <53F68A8E.4060105@redhat.com> <20140822082008.GA8447@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] issue: linking 64bit glib when building for cpu=i386 Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: John Snow , qemu-devel , Stefan Hajnoczi On Fri, Aug 22, 2014 at 09:28:05AM +0100, Peter Maydell wrote: > On 22 August 2014 09:20, Daniel P. Berrange wrote: > > Distros will install pkg-config .pc files for non-native architectures > > in a different location normally. The supported / recommended way to > > tell pkg-config to look in these alternative dirs is to set the env > > variable PKG_CONFIG_LIBDIR. This replaces the built-in default search > > directory that looks for native. > > > > So on a Fedora / RHELL system, to make pkg-config use 32-bit libs you > > want to set > > > > PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig > > > > which replaces the default location of /usr/lib64/pkgconfig. This is > > the same thing you'd need to do to build QEMU for say, mingw32 where > > you must set something like > > > > PKG_CONFIG_LIBDIR=/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig/ > > Yes, but this should be done by the i686-w64-mingw32-pkg-config > wrapper IMHO. (That's how I have my mingw setup configured, > anyway.) Sure if your distro wants to rebuild the pkg-config binary for each arch that is a valid approach too, but it is by no means required in order to get non-native builds working. > > Note, i say PKG_CONFIG_LIBDIR here, *not* PKG_CONFIG_PATH. The latter > > variable adds the default search path - you want to stop it looking in > > the default search path completely because it is the wrong arch, so > > must use PKG_CONFIG_LIBDIR > > Interestingly, Debian's cross-compile pkg-config wrapper > (aarch64-linux-gnu-pkg-config etc) sets PKG_CONFIG_PATH, > not PKG_CONFIG_LIBDIR. Maybe that's a bug, but it works... Yes, that would be a bug. Consider if you have mistakenly only installed the 64-bit dev package for libusb and not the 32-bit package. Now the 'libusb-1.0.pc' file will only be present in the directory /usr/lib64/pkgconfig but not in /usr/lib/pkgconfig. If you used PKG_CONFIG_PATH to point to the 32-bit directory, then it won't find the 32-bit libusb-1.0, so will fallback to looking in the 64-bit directory and repo the 64-bit version which is definitely not what you want. That'll lead to pain & suffering with wierd build and/or link errors. If you used PKG_CONFIG_LIBDIR then you'll get an immediate error from pkg-config telling you the 32-bit libusb-1.0 package was not installed. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|