diff mbox

MinGW compilation shouldn't include -lglib-2.0 etc.

Message ID 1311781823.44875.YahooMailClassic@web110409.mail.gq1.yahoo.com
State New
Headers show

Commit Message

Kenneth Salerno July 27, 2011, 3:50 p.m. UTC
Should check first if using a mingw compiler before forcing the addition of -lglib-2.0, -liconv, and -lintl to $LIBS of config-target.mak.


Signed-off-by: Kenneth Salerno <kennethsalerno@yahoo.com>



Regards,
Ken

Comments

Daniel P. Berrangé July 27, 2011, 3:56 p.m. UTC | #1
On Wed, Jul 27, 2011 at 08:50:23AM -0700, Kenneth Salerno wrote:
> Should check first if using a mingw compiler before forcing the addition of -lglib-2.0, -liconv, and -lintl to $LIBS of config-target.mak.
> 
> 
> Signed-off-by: Kenneth Salerno <kennethsalerno@yahoo.com>
> --- configure.ORIG      2011-07-27 11:28:16.859375000 -0400
> +++ configure   2011-07-27 11:43:59.859375000 -0400
> @@ -1824,9 +1824,11 @@
>  # glib support probe
>  if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then
>      glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
> -    glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null`
> -    libs_softmmu="$glib_libs $libs_softmmu"
> -    libs_tools="$glib_libs $libs_tools"
> +    if test "$mingw32" != "yes" ; then
> +        glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null`
> +        libs_softmmu="$glib_libs $libs_softmmu"
> +        libs_tools="$glib_libs $libs_tools"
> +    fi

This doesn't feel right to me. pkg-config works for mingw32 and should
be used just as it would be on native targets. What was the problem you
actually had without this change ?

If I had to guess I'd say your pkg-config program was not configured
to prefer mingw32 data files. You need to have an env var like this set
to make it pick up mingw32 rules instead of native ones:

 export PKG_CONFIG_LIBDIR="/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-pc-mingw32/sys-root/mingw/share/pkgconfig" pkg-config

Regards,
Daniel
Kenneth Salerno July 27, 2011, 8:46 p.m. UTC | #2
--- On Wed, 7/27/11, Daniel P. Berrange <berrange@redhat.com> wrote:

> From: Daniel P. Berrange <berrange@redhat.com>
> Subject: Re: [Qemu-devel] [PATCH] MinGW compilation shouldn't include -lglib-2.0 etc.
> To: "Kenneth Salerno" <kennethsalerno@yahoo.com>
> Cc: qemu-devel@nongnu.org
> Date: Wednesday, July 27, 2011, 11:56 AM
> On Wed, Jul 27, 2011 at 08:50:23AM
> -0700, Kenneth Salerno wrote:
> > Should check first if using a mingw compiler before
> forcing the addition of -lglib-2.0, -liconv, and -lintl to
> $LIBS of config-target.mak.
> > 
> > 
> > Signed-off-by: Kenneth Salerno <kennethsalerno@yahoo.com>
> > --- configure.ORIG      2011-07-27
> 11:28:16.859375000 -0400
> > +++ configure   2011-07-27
> 11:43:59.859375000 -0400
> > @@ -1824,9 +1824,11 @@
> >  # glib support probe
> >  if $pkg_config --modversion glib-2.0 >
> /dev/null 2>&1 ; then
> >      glib_cflags=`$pkg_config --cflags
> glib-2.0 2>/dev/null`
> > -    glib_libs=`$pkg_config --libs glib-2.0
> 2>/dev/null`
> > -    libs_softmmu="$glib_libs
> $libs_softmmu"
> > -    libs_tools="$glib_libs $libs_tools"
> > +    if test "$mingw32" != "yes" ; then
> > +        glib_libs=`$pkg_config
> --libs glib-2.0 2>/dev/null`
> > +        libs_softmmu="$glib_libs
> $libs_softmmu"
> > +        libs_tools="$glib_libs
> $libs_tools"
> > +    fi
> 
> This doesn't feel right to me. pkg-config works for mingw32
> and should
> be used just as it would be on native targets. What was the
> problem you
> actually had without this change ?
> 
> If I had to guess I'd say your pkg-config program was not
> configured
> to prefer mingw32 data files. You need to have an env var
> like this set
> to make it pick up mingw32 rules instead of native ones:
> 
>  export
> PKG_CONFIG_LIBDIR="/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-pc-mingw32/sys-root/mingw/share/pkgconfig"
> pkg-config
> 
> 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 :|
> 


I'll have to fall back to my old plan of compiling glib2 and gettext myself to install into prefix /usr/i686-pc-mingw32/sys-root/mingw (Cygwin doesn't distribute a MinGW version of glib2, and the one available on gtk.org gives me this error "cc1: warning: c:/devel/target/ea4ef54bcf881bcdd4139385601018a2/lib/glib-2.0/include: No such file or directory, but you are correct, I didn't need to modify qemu's 'configure').

Ken
Anthony Liguori July 27, 2011, 8:50 p.m. UTC | #3
On 07/27/2011 03:46 PM, Kenneth Salerno wrote:

>> --
>> |: 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 :|
>>
>
>
> I'll have to fall back to my old plan of compiling glib2 and gettext myself to install into prefix /usr/i686-pc-mingw32/sys-root/mingw (Cygwin doesn't distribute a MinGW version of glib2, and the one available on gtk.org gives me this error "cc1: warning: c:/devel/target/ea4ef54bcf881bcdd4139385601018a2/lib/glib-2.0/include: No such file or directory, but you are correct, I didn't need to modify qemu's 'configure').

Fedora packages mingw packages including glib:

http://fedoraproject.org/wiki/MinGW

Regards,

Anthony Liguori

> Ken
>
Stefan Weil July 27, 2011, 9:13 p.m. UTC | #4
Am 27.07.2011 22:46, schrieb Kenneth Salerno:
> I'll have to fall back to my old plan of compiling glib2 and gettext myself to install into prefix /usr/i686-pc-mingw32/sys-root/mingw (Cygwin doesn't distribute a MinGW version of glib2, and the one available on gtk.org gives me this error "cc1: warning: c:/devel/target/ea4ef54bcf881bcdd4139385601018a2/lib/glib-2.0/include: No such file or directory, but you are correct, I didn't need to modify qemu's 'configure').
>
> Ken
>    

You can fix the *.pc files (pkgconfig configuration) using your
installation path instead of c:/devel/..., then the gtk.org
distribution works (at least for me).

Cheers,
Stefan
Jernej Simončič July 27, 2011, 9:27 p.m. UTC | #5
On Wednesday, July 27, 2011, 22:46:41, Kenneth Salerno wrote:

> c:/devel/target/ea4ef54bcf881bcdd4139385601018a2/lib/glib-2.0/include: No such file or directory

This happens if you're not using mingw's pkg-config (which
automatically adjusts prefix) - you'll have to edit your .pc files.
Kenneth Salerno July 27, 2011, 9:29 p.m. UTC | #6
--- On Wed, 7/27/11, Stefan Weil <weil@mail.berlios.de> wrote:

> From: Stefan Weil <weil@mail.berlios.de>
> Subject: Re: [Qemu-devel] [PATCH] MinGW compilation shouldn't include -lglib-2.0 etc.
> To: "Kenneth Salerno" <kennethsalerno@yahoo.com>
> Cc: qemu-devel@nongnu.org
> Date: Wednesday, July 27, 2011, 5:13 PM
> Am 27.07.2011 22:46, schrieb Kenneth
> Salerno:
> > I'll have to fall back to my old plan of compiling
> glib2 and gettext myself to install into prefix
> /usr/i686-pc-mingw32/sys-root/mingw (Cygwin doesn't
> distribute a MinGW version of glib2, and the one available
> on gtk.org gives me this error "cc1: warning:
> c:/devel/target/ea4ef54bcf881bcdd4139385601018a2/lib/glib-2.0/include:
> No such file or directory, but you are correct, I didn't
> need to modify qemu's 'configure').
> >
> > Ken
> >    
> 
> You can fix the *.pc files (pkgconfig configuration) using
> your
> installation path instead of c:/devel/..., then the
> gtk.org
> distribution works (at least for me).
> 
> Cheers,
> Stefan
> 
> 


Yes, thank you! I had this exact same thought right after I sent my last message.
diff mbox

Patch

--- configure.ORIG      2011-07-27 11:28:16.859375000 -0400
+++ configure   2011-07-27 11:43:59.859375000 -0400
@@ -1824,9 +1824,11 @@ 
 # glib support probe
 if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then
     glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
-    glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null`
-    libs_softmmu="$glib_libs $libs_softmmu"
-    libs_tools="$glib_libs $libs_tools"
+    if test "$mingw32" != "yes" ; then
+        glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null`
+        libs_softmmu="$glib_libs $libs_softmmu"
+        libs_tools="$glib_libs $libs_tools"
+    fi
 else
     echo "glib-2.0 required to compile QEMU"
     exit 1