Skip to contentSkip to conversation

configure: Save PKG_CONFIG_LIBDIR and WINDRES in config.status

PATCH In review Thomas Huth 3 participants 6 messages Sep 4, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Save PKG_CONFIG_LIBDIR and WINDRES in config.status

When cross-compiling QEMU for a target that significantly differs from the host, the current information in config.status is not enough to properly re-create the configuration. For example when I try to test my build with the mingw32 cross-compiler, I regularly get this error after the build system tried to re-create the configuration with the config.status file:

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T.
You probably need to set PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build target

A similar problem exists for the "windres" tool, where you have to set the WINDRES variable in case it has a different name. So let's fix these issues by storing the configuration for these variables in the config.status file, too.

---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +6 -0
index 58862d2..4d8888f 100755
@@ -7534,6 +7534,12 @@ cat <<EOD >config.status
 # Compiler output produced by configure, useful for debugging
 # configure, is in config.log if it exists.
 EOD
+if [ -n "$PKG_CONFIG_LIBDIR" ]; then
+    echo "export PKG_CONFIG_LIBDIR=\"$PKG_CONFIG_LIBDIR\"" >>config.status
+fi
+if [ -n "$WINDRES" ]; then
+    echo "export WINDRES=\"$WINDRES\"" >>config.status
+fi
 printf "exec" >>config.status
 printf " '%s'" "$0" "$@" >>config.status
 echo ' "$@"' >>config.status
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 7 lines · Thomas Huth

When cross-compiling QEMU for a target that significantly differs from the host, the current information in config.status is not enough to properly re-create the configuration. For example when I try to test my build with the mingw32 cross-compiler, I regularly get this error after the build system tried to re-create the configuration with the config.status file:

Quoted 9 lines

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T.
You probably need to set PKG_CONFIG_LIBDIR
to point to the right pkg-config files for your build target
RAND
A similar problem exists for the "windres" tool, where you have to set the WINDRES variable in case it has a different name. So let's fix these issues by storing the configuration for theseq variables in the config.status file, too.

This is also true if the user set CC or RANLIB or any of a bunch of other environment variables that configure uses. If we're going to store those settings in config.status we should consistently do it for all environment variables we care about, I think.

What does autoconf do for the equivalent situation?

thanks
-- PMM

#2 lore raw
Quoted 18 lines · Peter Maydell
Quoted 7 lines · Thomas Huth

When cross-compiling QEMU for a target that significantly differs from the host, the current information in config.status is not enough to properly re-create the configuration. For example when I try to test my build with the mingw32 cross-compiler, I regularly get this error after the build system tried to re-create the configuration with the config.status file:

Quoted 9 lines

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T.
You probably need to set PKG_CONFIG_LIBDIR
to point to the right pkg-config files for your build target
RAND
A similar problem exists for the "windres" tool, where you have to set the WINDRES variable in case it has a different name. So let's fix these issues by storing the configuration for theseq variables in the config.status file, too.

Quoted 4 lines

This is also true if the user set CC or RANLIB or any of a bunch of other environment variables that configure uses. If we're going to store those settings in config.status we should consistently do it for all environment variables we care about, I think.

Ok, never mind, forget about WINDRES (and the other tools like RANLIB), that's not required, I just noticed that I simply forgot to specify "--cross-prefix=i686-w64-mingw32-" when running configure. With that option, i686-w64-mingw32-windres is properly used, and the pkg-config problem also goes away since i686-w64-mingw32-pkg-config is used instead.

But still, I think at least the PKG_CONFIG_LIBDIR part could be useful, since the same problem e.g. also occurs when trying do a 32-bit build on a 64-bit host, i.e. when running configure with "--extra-cflags=-m32". Or is there also another configure switch that can help to get PKG_CONFIG_LIBDIR right here?

Thomas

#3 lore raw
Quoted 5 lines · Thomas Huth

But still, I think at least the PKG_CONFIG_LIBDIR part could be useful, since the same problem e.g. also occurs when trying do a 32-bit build on a 64-bit host, i.e. when running configure with "--extra-cflags=-m32". Or is there also another configure switch that can help to get PKG_CONFIG_LIBDIR right here?

Personally I think the neatest way to handle 32-bit-build-on-64-bit-host is to treat it like any other non-native build, ie have the distro ship compiler, pkg-config, etc so that --cross-prefix=i686-linux-gnu- works :-)

thanks
-- PMM

#4 lore raw
In reply to Thomas Huth
Quoted 12 lines · Thomas Huth

When cross-compiling QEMU for a target that significantly differs from the host, the current information in config.status is not enough to properly re-create the configuration. For example when I try to test my build with the mingw32 cross-compiler, I regularly get this error after the build system tried to re-create the configuration with the config.status file:

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T.
You probably need to set PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build target

Quoted 4 lines

A similar problem exists for the "windres" tool, where you have to set the WINDRES variable in case it has a different name. So let's fix these issues by storing the configuration for these variables in the config.status file, too.

Doh, I sent a patch to fix this problem more broadly years ago now:

https://lists.nongnu.org/archive/html/qemu-devel/2015-11/msg04157.html

but it appears no maintainer ever merged it !

Quoted 12 lines
---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +0 -0
index 58862d2..4d8888f 100755
@@ -7534,6 +7534,12 @@ cat <<EOD >config.status
 # Compiler output produced by configure, useful for debugging
 # configure, is in config.log if it exists.

configure cat <<EOD >config.status · line 7545

Quoted 10 lines
configure +6 -0
 EOD
+if [ -n "$PKG_CONFIG_LIBDIR" ]; then
+    echo "export PKG_CONFIG_LIBDIR=\"$PKG_CONFIG_LIBDIR\"" >>config.status
+fi
+if [ -n "$WINDRES" ]; then
+    echo "export WINDRES=\"$WINDRES\"" >>config.status
+fi
 printf "exec" >>config.status
 printf " '%s'" "$0" "$@" >>config.status
 echo ' "$@"' >>config.status

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#5 lore raw
Quoted 18 lines · Daniel P. Berrangé
Quoted 12 lines · Thomas Huth

When cross-compiling QEMU for a target that significantly differs from the host, the current information in config.status is not enough to properly re-create the configuration. For example when I try to test my build with the mingw32 cross-compiler, I regularly get this error after the build system tried to re-create the configuration with the config.status file:

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T.
You probably need to set PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build target

Quoted 4 lines

A similar problem exists for the "windres" tool, where you have to set the WINDRES variable in case it has a different name. So let's fix these issues by storing the configuration for these variables in the config.status file, too.

Quoted 5 lines

Doh, I sent a patch to fix this problem more broadly years ago now:

https://lists.nongnu.org/archive/html/qemu-devel/2015-11/msg04157.html

but it appears no maintainer ever merged it !

This certainly eases some configurations ... could you refresh the patch and post it again?

Thomas