qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] issue: linking 64bit glib when building for cpu=i386


From: Peter Maydell
Subject: Re: [Qemu-devel] issue: linking 64bit glib when building for cpu=i386
Date: Tue, 23 Sep 2014 13:20:50 -0700

On 23 September 2014 11:52, John Snow <address@hidden> wrote:
> On 08/22/2014 05:05 AM, Stefan Hajnoczi wrote:
>> Nice, and Paolo sent me an automated way of doing that:
>>
>> On Fri, Aug 22, 2014 at 12:14:28AM +0200, Paolo Bonzini wrote:
>>>
>>> You need to set PKG_CONFIG_LIBDIR to
>>>
>>> /usr/lib/$MULTILIBDIR/pkgconfig
>>>
>>> where MULTILIBDIR is
>>>
>>>      if $CC -print-multiarch >/dev/null 2>&1; then
>>>        MULTILIBDIR=`$CC -print-multiarch $CFLAGS $CPPFLAGS`
>>>      fi
>>>      if test -z "$MULTILIBDIR"; then
>>>        MULTILIBDIR=`$CC --print-multi-os-directory $CFLAGS $CPPFLAGS`
>>>      fi
>>>
>>> This will point at /usr/lib/pkgconfig/glib-2.0.pc instead of
>>> /usr/lib64/pkgconfig/glib-2.0.pc

> A barrier into introducing this into the configuration script is that clang,
> used on OSX hosts, does not support these print flags.
>
> Even worse, clang --print-multi-os-directory produces "x86_64" on Fedora 20,
> which will lead to an erroneous configuration.
>
> So we'll have to look into another way to support cross-compilation for i386
> on x86_64 to avoid script breakage on other platforms.
>
> Any other ideas? It looks as if there have been proposals in the past to add
> some multi-arch awareness into pkg-config, but they haven't gone anywhere.
> So some tool needs to tell pkg-config where to look, but clang is apparently
> not up to the job.

If you're cross compiling you should probably pass configure
--cross-prefix=whatever-
and make sure your compiler and the pkg-config wrapper which sets
PKG_CONFIG_LIBDIR are all suitably named whatever-cc,
whatever-pkg-config etc. This is the sort of cross compile environment
which configure is designed to work with (and it's the distro's
job to get that environment set up, not QEMU's).

The runes above are specifically for Fedora x86_64-to-i386
compilation, which is a very special case (though you
can treat this like a full cross compile if you want,
which is the direction Debian are taking cross builds with
multiarch).

(In particular, for a cross compile from Fedora to OSX you want a
cross-clang targeting MacOSX and a cross set of libraries and
includes and a cross set of pkg-config config files, so you
definitely don't want to be running the build host's clang or
its pkg-config.)

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]