Fix SDL configuration for mingw32 cross compilation.
PATCH 1/1 Fix SDL configuration for mingw32 cross compilation.
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.
--- configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
@@ -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
Signature · 1 line
1.5.6.5
Quoted 7 lines · Stefan Weil
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.
Signature · 3 lines
Regards, Anthony Liguori
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Stefan Weil
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.
Quoted 7 lines
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
Quoted 16 lines · Stefan Weil
Quoted 14 lines · Anthony Liguori
Quoted 8 lines · Stefan Weil
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.
Quoted 9 lines
Quoted 4 lines
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
Quoted 27 lines · Anthony Liguori
Quoted 16 lines · Stefan Weil
Quoted 14 lines · Anthony Liguori
Quoted 8 lines · Stefan Weil
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.
Quoted 9 lines
Quoted 4 lines
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).
Quoted 4 lines
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_PATHis 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
Quoted 39 lines · Jamie Lokier
Quoted 31 lines · Anthony Liguori
Quoted 19 lines · Stefan Weil
Quoted 16 lines · Anthony Liguori
Quoted 9 lines · Stefan Weil
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.
Quoted 10 lines
Quoted 5 lines
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).Quoted 5 lines
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_PATHis also important for running configure. To properly cross compile, you need to set both.
Quoted 10 lines
You can record PATH and other environment variables picked up at configure time in the
Makefileitself. 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
Quoted 51 lines · Stefan Weil
Quoted 39 lines · Jamie Lokier
Quoted 31 lines · Anthony Liguori
Quoted 19 lines · Stefan Weil
Quoted 16 lines · Anthony Liguori
Quoted 9 lines · Stefan Weil
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.
Quoted 10 lines
Quoted 5 lines
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).Quoted 5 lines
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_PATHis also important for running configure. To properly cross compile, you need to set both.Quoted 10 lines
You can record PATH and other environment variables picked up at configure time in the
Makefileitself. Makefile.in:export PATH = @PATH@
It's not pretty, but it works.
-- Jamie
Quoted 5 lines
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
Quoted 32 lines · Jamie Lokier
Quoted 18 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
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_PATHis also important for running configure. To properly cross compile, you need to set both.Quoted 10 lines
You can record PATH and other environment variables picked up at configure time in the
Makefileitself. Makefile.in:export PATH = @PATH@
It's not pretty, but it works.
-- Jamie
Quoted 5 lines
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 theMakefile, or you'd put "export PATH=..." and "export PKG_CONFIG_PATH=..." in config-host.mak and nothing in theMakefile.
Quoted 4 lines
The main thing is, after recording them, you might have to export PATH in
Makefileor config-host.mak to have the required effect. I guessPKG_CONFIG_PATHwon'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
Signature · 4 lines
|: 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 :|