configure: Test that gio libs from pkg-config work
PATCH 1/1 configure: Test that gio libs from pkg-config work
On some hosts (eg Ubuntu Bionic) pkg-config returns a set of libraries for gio-2.0 which don't actually work when compiling statically. (Specifically, the returned library string includes -lmount, but not -lblkid which -lmount depends upon, so linking fails due to missing symbols.)
Check that the libraries work, and don't enable gio if they don't, in the same way we do for gnutls.
---
I wanted a statically-linked system emulation binary (which, yes, I know is not really something we support :-)). I got one with suitably liberal use of --disable-foo configure options, and this was the only thing I couldn't work around that way. The patch is needed because there's no --disable-gio. I suppose we could add that instead (or as well)...
Possibly meson offers a nicer way to do this, but this was simple and gnutls is doing the check this way already.
--- configure | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
configure +9 -1
@@ -3762,13 +3762,21 @@ if test "$static" = yes && test "$mingw32" = yes; then fi if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then - gio=yes gio_cflags=$($pkg_config --cflags gio-2.0) gio_libs=$($pkg_config --libs gio-2.0) gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) if [ ! -x "$gdbus_codegen" ]; then gdbus_codegen= fi + # Check that the libraries actually work -- Ubuntu 18.04 ships + # with pkg-config --static --libs data for gio-2.0 that is missing + # -lblkid and will give a link error. + write_c_skeleton + if compile_prog "" "gio_libs" ; then + gio=yes + else + gio=no + fi else gio=no fi
Signature · 1 line
2.20.1
Quoted 8 lines · Peter Maydell
I wanted a statically-linked system emulation binary (which, yes, I know is not really something we support :-)). I got one with suitably liberal use of --disable-foo configure options, and this was the only thing I couldn't work around that way. The patch is needed because there's no --disable-gio. I suppose we could add that instead (or as well)...
Possibly meson offers a nicer way to do this, but this was simple and gnutls is doing the check this way already.
No, you'd get just that warning about static libraries not being available; so I think either this patch or --disable-gio is fine.
Paolo
Quoted 11 lines · Paolo Bonzini
Quoted 8 lines · Peter Maydell
I wanted a statically-linked system emulation binary (which, yes, I know is not really something we support :-)). I got one with suitably liberal use of --disable-foo configure options, and this was the only thing I couldn't work around that way. The patch is needed because there's no --disable-gio. I suppose we could add that instead (or as well)...
Possibly meson offers a nicer way to do this, but this was simple and gnutls is doing the check this way already.
Quoted 2 lines
No, you'd get just that warning about static libraries not being available; so I think either this patch or --disable-gio is fine.
Could I have a Reviewed-by: if you're happy with this patch?
thanks
-- PMM
Paolo Bonzini
Reviewed-byQuoted 12 lines · Peter Maydell
Quoted 11 lines · Paolo Bonzini
Quoted 8 lines · Peter Maydell
I wanted a statically-linked system emulation binary (which, yes, I know is not really something we support :-)). I got one with suitably liberal use of --disable-foo configure options, and this was the only thing I couldn't work around that way. The patch is needed because there's no --disable-gio. I suppose we could add that instead (or as well)...
Possibly meson offers a nicer way to do this, but this was simple and gnutls is doing the check this way already.
Quoted 4 lines
Quoted 2 lines
No, you'd get just that warning about static libraries not being available; so I think either this patch or --disable-gio is fine.
Could I have a Reviewed-by: if you're happy with this patch?
Quoted 19 lines · Peter Maydell
On some hosts (eg Ubuntu Bionic) pkg-config returns a set of libraries for gio-2.0 which don't actually work when compiling statically. (Specifically, the returned library string includes -lmount, but not -lblkid which -lmount depends upon, so linking fails due to missing symbols.)
Check that the libraries work, and don't enable gio if they don't, in the same way we do for gnutls.
Signed-off-by Peter Maydell <[email protected]>---
I wanted a statically-linked system emulation binary (which, yes, I know is not really something we support :-)). I got one with suitably liberal use of --disable-foo configure options, and this was the only thing I couldn't work around that way. The patch is needed because there's no --disable-gio. I suppose we could add that instead (or as well)...
Possibly meson offers a nicer way to do this, but this was simple and gnutls is doing the check this way already.
Quoted 3 lines
--- configure | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)