All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation.
@ 2009-06-13  8:01 Stefan Weil
  2009-06-13 22:24 ` Anthony Liguori
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2009-06-13  8:01 UTC (permalink / raw)
  To: qemu-devel

When building QEMU for win32 on linux with mingw32,
configure must call ${cross_prefix}-sdl-config (not
sdl-config) to get the correct include and lib paths.

The results of the native sdl-config are only valid
for native builds. They are useless for cross builds.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 48c8949..35b8fbf 100755
--- a/configure
+++ b/configure
@@ -862,7 +862,7 @@ fi
 sdl_too_old=no
 
 if test "$sdl" = "yes" ; then
-    sdl_config="sdl-config"
+    sdl_config="${cross_prefix}sdl-config"
     sdl=no
     sdl_static=no
 
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation.
  2009-06-13  8:01 [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation Stefan Weil
@ 2009-06-13 22:24 ` Anthony Liguori
  2009-06-14 14:00   ` Stefan Weil
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony Liguori @ 2009-06-13 22:24 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

Stefan Weil wrote:
> When building QEMU for win32 on linux with mingw32,
> configure must call ${cross_prefix}-sdl-config (not
> sdl-config) to get the correct include and lib paths.
>
> The results of the native sdl-config are only valid
> for native builds. They are useless for cross builds.
>   

No, when you cross compile sdl, you still end up with an sdl-config 
binary.  The solution is to install the binary to a different path and 
use PATH when building.

Where did you get your cross build of SDL from?  I assume whoever 
packaged it renamed the binary but it's not what sdl actually does.

-- 
Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation.
  2009-06-13 22:24 ` Anthony Liguori
@ 2009-06-14 14:00   ` Stefan Weil
  2009-06-15  2:20     ` Anthony Liguori
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2009-06-14 14:00 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

Anthony Liguori schrieb:
> Stefan Weil wrote:
>> When building QEMU for win32 on linux with mingw32,
>> configure must call ${cross_prefix}-sdl-config (not
>> sdl-config) to get the correct include and lib paths.
>>
>> The results of the native sdl-config are only valid
>> for native builds. They are useless for cross builds.
>>   
>
> No, when you cross compile sdl, you still end up with an sdl-config
> binary.  The solution is to install the binary to a different path and
> use PATH when building.
>
> Where did you get your cross build of SDL from?  I assume whoever
> packaged it renamed the binary but it's not what sdl actually does.
>

The PATH solution works (I used it, too), but it is bad:
you have to use a modified PATH for every cross build
(make calls configure when the configure script is updated).

http://www.libsdl.org/release/SDL-devel-1.2.9-mingw32.tar.gz
contains i386-mingw32msvc-sdl-config. It is rather old,
but I liked this and renamed it to i586-mingw32msvc-sdl-config.
When I installed newer versions of cross SDL, I made
a symbolic link from cross sdl-config to i586-mingw32msvc-sdl-config.

There is a quasi-standard for cross tools: binutils and gcc
are installed in a similar way. For example,
/usr/bin/i586-mingw32msvc-strip and
/usr/i586-mingw32msvc/bin/strip are (hard) linked.

If your cross sdl-config happens to be in
/usr/i586-mingw32msvc/bin and you add this to PATH,
you will see another problem caused by the PATH solution:
you will get the wrong binutils (ar, as, strip, ...)!
Ok, cross sdl-config (which is a script, not a binary)
can have its own directory, then this is not a problem.

sdl-config exists because users should not need to know
paths for includes, libs (and binaries) but have a simple
interface to ask for the information they need.

The same simple interface is needed for cross sdl.

There are no packages with cross build SDL (at least I
don't know any), so it is always a manual installation.
Adding a symbolic link is then easy:
ln -s /usr/i586-mingw32msvc/bin/sdl-config
/usr/bin/i586-mingw32msvc-sdl-config.
Looking for i586-mingw32msvc-sdl-config at google shows
that others use this solution, too.

Even better for most users would be a package or tar file
which installs the sdl cross environment needed for QEMU
mingw32 cross builds. Should I prepare one?

Or you could add a configure option which tells configure
where to look for sdl-config or its base directory,
something like --with-sdl-prefix=/usr/i586-mingw32msvc
(this is used by other projects, see google).

Regards

Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation.
  2009-06-14 14:00   ` Stefan Weil
@ 2009-06-15  2:20     ` Anthony Liguori
  2009-06-16 15:28       ` Jamie Lokier
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony Liguori @ 2009-06-15  2:20 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

Stefan Weil wrote:
> Anthony Liguori schrieb:
>   
>> Stefan Weil wrote:
>>     
>>> When building QEMU for win32 on linux with mingw32,
>>> configure must call ${cross_prefix}-sdl-config (not
>>> sdl-config) to get the correct include and lib paths.
>>>
>>> The results of the native sdl-config are only valid
>>> for native builds. They are useless for cross builds.
>>>   
>>>       
>> No, when you cross compile sdl, you still end up with an sdl-config
>> binary.  The solution is to install the binary to a different path and
>> use PATH when building.
>>
>> Where did you get your cross build of SDL from?  I assume whoever
>> packaged it renamed the binary but it's not what sdl actually does.
>>
>>     
>
> The PATH solution works (I used it, too), but it is bad:
> you have to use a modified PATH for every cross build
> (make calls configure when the configure script is updated).
>   

Yes, this annoys me too.  One thing I thought about is that we could 
record important environment variables for use when re-running make.
It's not just PATH.  PKG_CONFIG_PATH is also important for running 
configure.  To properly cross compile, you need to set both.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation.
  2009-06-15  2:20     ` Anthony Liguori
@ 2009-06-16 15:28       ` Jamie Lokier
  2009-06-16 16:31         ` Stefan Weil
  0 siblings, 1 reply; 8+ messages in thread
From: Jamie Lokier @ 2009-06-16 15:28 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

Anthony Liguori wrote:
> Stefan Weil wrote:
> >Anthony Liguori schrieb:
> >  
> >>Stefan Weil wrote:
> >>    
> >>>When building QEMU for win32 on linux with mingw32,
> >>>configure must call ${cross_prefix}-sdl-config (not
> >>>sdl-config) to get the correct include and lib paths.
> >>>
> >>>The results of the native sdl-config are only valid
> >>>for native builds. They are useless for cross builds.
> >>>  
> >>>      
> >>No, when you cross compile sdl, you still end up with an sdl-config
> >>binary.  The solution is to install the binary to a different path and
> >>use PATH when building.
> >>
> >>Where did you get your cross build of SDL from?  I assume whoever
> >>packaged it renamed the binary but it's not what sdl actually does.
> >>
> >>    
> >
> >The PATH solution works (I used it, too), but it is bad:
> >you have to use a modified PATH for every cross build
> >(make calls configure when the configure script is updated).
> >  
> 
> Yes, this annoys me too.  One thing I thought about is that we could 
> record important environment variables for use when re-running make.
> It's not just PATH.  PKG_CONFIG_PATH is also important for running 
> configure.  To properly cross compile, you need to set both.

You can record PATH and other environment variables picked up at
configure time in the Makefile itself.  Makefile.in:

   export PATH = @PATH@

It's not pretty, but it works.

-- Jamie

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation.
  2009-06-16 15:28       ` Jamie Lokier
@ 2009-06-16 16:31         ` Stefan Weil
  2009-06-16 18:14           ` Jamie Lokier
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Weil @ 2009-06-16 16:31 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: QEMU Developers

Jamie Lokier schrieb:
> Anthony Liguori wrote:
>   
>> Stefan Weil wrote:
>>     
>>> Anthony Liguori schrieb:
>>>  
>>>       
>>>> Stefan Weil wrote:
>>>>    
>>>>         
>>>>> When building QEMU for win32 on linux with mingw32,
>>>>> configure must call ${cross_prefix}-sdl-config (not
>>>>> sdl-config) to get the correct include and lib paths.
>>>>>
>>>>> The results of the native sdl-config are only valid
>>>>> for native builds. They are useless for cross builds.
>>>>>  
>>>>>      
>>>>>           
>>>> No, when you cross compile sdl, you still end up with an sdl-config
>>>> binary.  The solution is to install the binary to a different path and
>>>> use PATH when building.
>>>>
>>>> Where did you get your cross build of SDL from?  I assume whoever
>>>> packaged it renamed the binary but it's not what sdl actually does.
>>>>
>>>>    
>>>>         
>>> The PATH solution works (I used it, too), but it is bad:
>>> you have to use a modified PATH for every cross build
>>> (make calls configure when the configure script is updated).
>>>  
>>>       
>> Yes, this annoys me too.  One thing I thought about is that we could 
>> record important environment variables for use when re-running make.
>> It's not just PATH.  PKG_CONFIG_PATH is also important for running 
>> configure.  To properly cross compile, you need to set both.
>>     
>
> You can record PATH and other environment variables picked up at
> configure time in the Makefile itself.  Makefile.in:
>
>    export PATH = @PATH@
>
> It's not pretty, but it works.
>
> -- Jamie
>
>   

Only with autoconf / automake? QEMU does not use them,
so there is no Makefile.in.

I'd prefer setting paths for pkg-config and sdl-config via
configure options (those are recorded in config-host.mak).

Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation.
  2009-06-16 16:31         ` Stefan Weil
@ 2009-06-16 18:14           ` Jamie Lokier
  2009-06-17 10:27             ` Daniel P. Berrange
  0 siblings, 1 reply; 8+ messages in thread
From: Jamie Lokier @ 2009-06-16 18:14 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers

Stefan Weil wrote:
> Jamie Lokier schrieb:
> > Anthony Liguori wrote:
> >   
> >> Stefan Weil wrote:
> >>     
> >>> Anthony Liguori schrieb:
> >>>  
> >>>       
> >>>> Stefan Weil wrote:
> >>>>    
> >>>>         
> >>>>> When building QEMU for win32 on linux with mingw32,
> >>>>> configure must call ${cross_prefix}-sdl-config (not
> >>>>> sdl-config) to get the correct include and lib paths.
> >>>>>
> >>>>> The results of the native sdl-config are only valid
> >>>>> for native builds. They are useless for cross builds.
> >>>>>  
> >>>>>      
> >>>>>           
> >>>> No, when you cross compile sdl, you still end up with an sdl-config
> >>>> binary.  The solution is to install the binary to a different path and
> >>>> use PATH when building.
> >>>>
> >>>> Where did you get your cross build of SDL from?  I assume whoever
> >>>> packaged it renamed the binary but it's not what sdl actually does.
> >>>>
> >>>>    
> >>>>         
> >>> The PATH solution works (I used it, too), but it is bad:
> >>> you have to use a modified PATH for every cross build
> >>> (make calls configure when the configure script is updated).
> >>>  
> >>>       
> >> Yes, this annoys me too.  One thing I thought about is that we could 
> >> record important environment variables for use when re-running make.
> >> It's not just PATH.  PKG_CONFIG_PATH is also important for running 
> >> configure.  To properly cross compile, you need to set both.
> >>     
> >
> > You can record PATH and other environment variables picked up at
> > configure time in the Makefile itself.  Makefile.in:
> >
> >    export PATH = @PATH@
> >
> > It's not pretty, but it works.
> >
> > -- Jamie
> >
> >   
> 
> Only with autoconf / automake? QEMU does not use them,
> so there is no Makefile.in.
> 
> I'd prefer setting paths for pkg-config and sdl-config via
> configure options (those are recorded in config-host.mak).

You can use it with anything which controls the variables like $(CC)
in Makefiles.  Doesn't have to be Autoconf.

So you'd either put PATH=... and PKG_CONFIG_PATH=... in
config-host.mak plus "export PATH PKG_CONFIG_PATH" in the Makefile, or
you'd put "export PATH=..." and "export PKG_CONFIG_PATH=..." in
config-host.mak and nothing in the Makefile.

The main thing is, after recording them, you might have to export PATH
in Makefile or config-host.mak to have the required effect.  I guess
PKG_CONFIG_PATH won't need exporting globally; only in commands which
call pkg-config.

-- Jamie

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation.
  2009-06-16 18:14           ` Jamie Lokier
@ 2009-06-17 10:27             ` Daniel P. Berrange
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel P. Berrange @ 2009-06-17 10:27 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: QEMU Developers

On Tue, Jun 16, 2009 at 07:14:56PM +0100, Jamie Lokier wrote:
> > >>>       
> > >> Yes, this annoys me too.  One thing I thought about is that we could 
> > >> record important environment variables for use when re-running make.
> > >> It's not just PATH.  PKG_CONFIG_PATH is also important for running 
> > >> configure.  To properly cross compile, you need to set both.
> > >>     
> > >
> > > You can record PATH and other environment variables picked up at
> > > configure time in the Makefile itself.  Makefile.in:
> > >
> > >    export PATH = @PATH@
> > >
> > > It's not pretty, but it works.
> > >
> > > -- Jamie
> > >
> > >   
> > 
> > Only with autoconf / automake? QEMU does not use them,
> > so there is no Makefile.in.
> > 
> > I'd prefer setting paths for pkg-config and sdl-config via
> > configure options (those are recorded in config-host.mak).
> 
> You can use it with anything which controls the variables like $(CC)
> in Makefiles.  Doesn't have to be Autoconf.
> 
> So you'd either put PATH=... and PKG_CONFIG_PATH=... in
> config-host.mak plus "export PATH PKG_CONFIG_PATH" in the Makefile, or
> you'd put "export PATH=..." and "export PKG_CONFIG_PATH=..." in
> config-host.mak and nothing in the Makefile.
> 
> The main thing is, after recording them, you might have to export PATH
> in Makefile or config-host.mak to have the required effect.  I guess
> PKG_CONFIG_PATH won't need exporting globally; only in commands which
> call pkg-config.

For cross-compiling you shouldn't actually use PKG_CONFIG_PATH. This just
adds extra search locations - so if you didn't have the cross-compiled
pkg config data file present, it'd fallback to giving you the native one
which is not what you want. Instead you should set PKG_CONFIG_LIBDIR to
point to the mingw tree so that you are guarenteed it'll never fallback
to native configs.  

FYI for people using Fedora mingw32  packages, there is a 'mingw32-env'
shell alias which sets this and many other vars:

  ADDR2LINE=/usr/bin/i686-pc-mingw32-addr2line
  AR=/usr/bin/i686-pc-mingw32-ar
  AS=/usr/bin/i686-pc-mingw32-as
  CC=i686-pc-mingw32-gcc
  CPP=/usr/bin/i686-pc-mingw32-cpp
  CXXFILT=/usr/bin/i686-pc-mingw32-c++filt
  DLLTOOL=/usr/bin/i686-pc-mingw32-dlltool
  DLLWRAP=/usr/bin/i686-pc-mingw32-dllwrap
  FREETYPE_CONFIG=/usr/i686-pc-mingw32/sys-root/mingw/bin/freetype-config
  GCC=/usr/bin/i686-pc-mingw32-gcc
  GCCBUG=/usr/bin/i686-pc-mingw32-gccbug
  GCOV=/usr/bin/i686-pc-mingw32-gcov
  GPG_ERROR_CONFIG=/usr/i686-pc-mingw32/sys-root/mingw/bin/gpg-error-config
  GPROF=/usr/bin/i686-pc-mingw32-gprof
  HOST_CC=gcc
  LD=/usr/bin/i686-pc-mingw32-ld
  LIBGCRYPT_CONFIG=/usr/i686-pc-mingw32/sys-root/mingw/bin/libgcrypt-config
  LIBGNUTLS_CONFIG=/usr/i686-pc-mingw32/sys-root/mingw/bin/libgnutls-config
  LIBGNUTLS_EXTRA_CONFIG=/usr/i686-pc-mingw32/sys-root/mingw/bin/libgnutls-extra-config
  LIBPNG12_CONFIG=/usr/i686-pc-mingw32/sys-root/mingw/bin/libpng12-config
  LIBPNG_CONFIG=/usr/i686-pc-mingw32/sys-root/mingw/bin/libpng-config
  NM=/usr/bin/i686-pc-mingw32-nm
  OBJCOPY=/usr/bin/i686-pc-mingw32-objcopy
  OBJDUMP=/usr/bin/i686-pc-mingw32-objdump
  PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig
  RANLIB=/usr/bin/i686-pc-mingw32-ranlib
  READELF=/usr/bin/i686-pc-mingw32-readelf
  SIZE=/usr/bin/i686-pc-mingw32-size
  STRINGS=/usr/bin/i686-pc-mingw32-strings
  STRIP=/usr/bin/i686-pc-mingw32-strip
  WINDMC=/usr/bin/i686-pc-mingw32-windmc
  WINDRES=/usr/bin/i686-pc-mingw32-windres
  XML2_CONFIG=/usr/i686-pc-mingw32/sys-root/mingw/bin/xml2-config

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-06-17 10:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-13  8:01 [Qemu-devel] [PATCH] Fix SDL configuration for mingw32 cross compilation Stefan Weil
2009-06-13 22:24 ` Anthony Liguori
2009-06-14 14:00   ` Stefan Weil
2009-06-15  2:20     ` Anthony Liguori
2009-06-16 15:28       ` Jamie Lokier
2009-06-16 16:31         ` Stefan Weil
2009-06-16 18:14           ` Jamie Lokier
2009-06-17 10:27             ` Daniel P. Berrange

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.