Fixes for Linux->Win32 cross-compilation
cover Fixes for Linux->Win32 cross-compilation
With this series I could test cross-compiled Win32 QEMU under Wine. The VNC server fails with "inet_parse: ipv4 parse error (0)", so I had to use SDL; but this patch series is needed to find SDL when cross compiling.
Paolo Bonzini (3):
use cross-prefix for pkg-config
use pkg-config for sdl when cross compiling
use pkg-config for libcurl when cross compiling
configure | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 37 insertions(+), 15 deletions(-)
PATCH 1/3 use cross-prefix for pkg-config
Since pkg-config can give different output for different targets, it should be tried with the cross-compilation prefix first. (Note that the autoconf macro for pkg-config uses AC_PATH_TOOL, which also tries to add the prefix).
--- configure | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-)
configure +14 -5
@@ -965,6 +965,15 @@ EOF fi ########################################## +# pkgconfig probe + +pkgconfig="${cross_prefix}pkg-config" +if ! test -x "$(which $pkgconfig 2>/dev/null)"; then + # hosed installation, hope for the best + pkgconfig=pkg-config +fi + +########################################## # Sparse probe if test "$sparse" != "no" ; then if test -x "$(which cgcc 2>/dev/null)"; then
@@ -1047,8 +1056,8 @@ if test "$vnc_tls" != "no" ; then #include <gnutls/gnutls.h> int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } EOF - vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null` - vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null` + vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null` + vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null` if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then vnc_tls=yes libs_softmmu="$vnc_tls_libs $libs_softmmu"
@@ -1320,7 +1329,7 @@ if test "$check_utests" != "no" ; then #include <check.h> int main(void) { suite_create("qemu test"); return 0; } EOF - check_libs=`pkg-config --libs check` + check_libs=`$pkgconfig --libs check` if compile_prog "" $check_libs ; then check_utests=yes libs_tools="$check_libs $libs_tools"
@@ -1339,8 +1348,8 @@ if test "$bluez" != "no" ; then #include <bluetooth/bluetooth.h> int main(void) { return bt_error(0); } EOF - bluez_cflags=`pkg-config --cflags bluez 2> /dev/null` - bluez_libs=`pkg-config --libs bluez 2> /dev/null` + bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null` + bluez_libs=`$pkgconfig --libs bluez 2> /dev/null` if compile_prog "$bluez_cflags" "$bluez_libs" ; then bluez=yes libs_softmmu="$bluez_libs $libs_softmmu"
Signature · 1 line
1.6.5.2
PATCH 2/3 use pkg-config for sdl when cross compiling
In reply to Paolo BonziniTogether with the previous patch this enables using the prefixed pkg-config, thus picking up the correct flags for SDL. Since pkg-config has an awful lot of dependencies, I still use sdl-config when not cross-compiling since some people may only have the latter.
--- configure | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-)
configure +15 -8
@@ -989,18 +989,24 @@ fi ########################################## # SDL probe -sdl_too_old=no +if test "$pkgconfig" = pkg-config; then + sdlconfig='sdl-config' + _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` +else + sdlconfig="$pkgconfig sdl" + _sdlversion=`$sdlconfig --modversion | sed 's/[^0-9]//g'` +fi +sdl_too_old=no if test "$sdl" != "no" ; then cat > $TMPC << EOF #include <SDL.h> #undef main /* We don't want SDL to override our main() */ int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } EOF - sdl_cflags=`sdl-config --cflags 2> /dev/null` - sdl_libs=`sdl-config --libs 2> /dev/null` + sdl_cflags=`$sdlconfig --cflags 2> /dev/null` + sdl_libs=`$sdlconfig --libs 2> /dev/null` if compile_prog "$sdl_cflags" "$sdl_libs" ; then - _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'` if test "$_sdlversion" -lt 121 ; then sdl_too_old=yes else
@@ -1009,10 +1015,11 @@ EOF fi fi - # static link with sdl ? - if test "$sdl" = "yes" -a "$static" = "yes" ; then - sdl_libs=`sdl-config --static-libs 2>/dev/null` - if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then + # static link with sdl ? sdl.pc is broken here, so if cross-compiling + # hope for the best + if test "$sdl" = "yes" -a "$static" = "yes" -a "$sdlconfig" = sdl-config; then + sdl_libs=`$sdlconfig --static-libs 2>/dev/null` + if test `$sdlconfig --static-libs 2>/dev/null | grep \\\-laa > /dev/null`; then sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`" sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`" fi
Signature · 1 line
1.6.5.2
Re: [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling
Quoted 5 lines · Paolo Bonzini
Together with the previous patch this enables using the prefixed pkg-config, thus picking up the correct flags for SDL. Since pkg-config has an awful lot of dependencies, I still use sdl-config when not cross-compiling since some people may only have the latter.
Wouldn't it make more sense to try to use pkg-config always and if it's not available, fall back on sdl-config?
That means we don't have a separate code path for cross compiling which means it's less likely to break.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling
Quoted 6 lines · Anthony Liguori
Wouldn't it make more sense to try to use pkg-config always and if it's not available, fall back on sdl-config?
That means we don't have a separate code path for cross compiling which means it's less likely to break.
I certainly can make that, I wanted to avoid changing the most frequently used path to avoid breaking stuff more than I already did. :-(
It's not frequently-changing code, so it's not so likely to break.
Paolo
Re: [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling
Quoted 11 lines · Paolo Bonzini
Quoted 6 lines · Anthony Liguori
Wouldn't it make more sense to try to use pkg-config always and if it's not available, fall back on sdl-config?
That means we don't have a separate code path for cross compiling which means it's less likely to break.
I certainly can make that, I wanted to avoid changing the most frequently used path to avoid breaking stuff more than I already did. :-(
It's not frequently-changing code, so it's not so likely to break.
I'd prefer that we have a single code path instead of different paths for cross compiling.
Regards,
Anthony Liguori
Quoted 1 line
Paolo
PATCH 3/3 use pkg-config for libcurl when cross compiling
In reply to Paolo Bonzini--- configure | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
configure +8 -2
@@ -1309,13 +1309,19 @@ fi ########################################## # curl probe +if test "$pkgconfig" = pkg-config; then + curlconfig=curl-config +else + curlconfig='$pkgconfig libcurl' +fi + if test "$curl" != "no" ; then cat > $TMPC << EOF #include <curl/curl.h> int main(void) { return curl_easy_init(); } EOF - curl_cflags=`curl-config --cflags 2>/dev/null` - curl_libs=`curl-config --libs 2>/dev/null` + curl_cflags=`$curlconfig --cflags 2>/dev/null` + curl_libs=`$curlconfig --libs 2>/dev/null` if compile_prog "$curl_cflags" "$curl_libs" ; then curl=yes libs_tools="$curl_libs $libs_tools"
Signature · 1 line
1.6.5.2
Quoted 6 lines · Paolo Bonzini
With this series I could test cross-compiled Win32 QEMU under Wine. The VNC server fails with "
inet_parse: ipv4 parse error (0)", so I had to use SDL; but this patch series is needed to find SDL when cross compiling.
Quoted 8 lines
Paolo Bonzini (3):
use cross-prefix for pkg-config
use pkg-config for sdl when cross compiling
use pkg-config for libcurl when cross compilingconfigure | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 37 insertions(+), 15 deletions(-)
Hi,
VNC server works here (tested with
wine i386-softmmu/qemu.exe -L pc-bios -vnc :0).
Cross compilation works without patches when PATH is modified so it finds the correct sdl-config (but my configuration did not include a cross libcurl).
Regards,
Stefan
Quoted 3 lines
Cross compilation works without patches when PATH is modified so it finds the correct sdl-config
True, but anything beyond "./configure --cross-prefix=cpu-vendor-os-" (or --host for autoconf) is a bug in either your setup or your package or both.
Paolo
Quoted 5 lines · Paolo Bonzini
Quoted 3 lines
Cross compilation works without patches when PATH is modified so it finds the correct sdl-config
True, but anything beyond "./configure --cross-prefix=cpu-vendor-os-" (or --host for autoconf) is a bug in either your setup or your package or both.
Last I tried, sdl-config didn't actually install sdl-config with a cross prefix when cross compiled..
Regards,
Anthony Liguori
Quoted 3 lines
Paolo
Quoted 11 lines · Anthony Liguori
Quoted 7 lines · Paolo Bonzini
Quoted 3 lines
Cross compilation works without patches when PATH is modified so it finds the correct sdl-config
True, but anything beyond "./configure --cross-prefix=cpu-vendor-os-" (or --host for autoconf) is a bug in either your setup or your package or both.
Last I tried, sdl-config didn't actually install sdl-config with a cross prefix when cross compiled..
Yes, that's why I'm trying to use pkg-config when cross compiling in patches 2/3 and 3/3.
Paolo