Message ID | 20200928160402.7961-1-peter.maydell@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | configure: Test that gio libs from pkg-config work | expand |
On 28/09/20 18:04, Peter Maydell wrote: > 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
On Mon, 28 Sep 2020 at 17:42, Paolo Bonzini <pbonzini@redhat.com> wrote: > > On 28/09/20 18:04, Peter Maydell wrote: > > 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. Could I have a Reviewed-by: if you're happy with this patch? thanks -- PMM
On 9/28/20 6:04 PM, Peter Maydell wrote: > 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 <peter.maydell@linaro.org> > --- > 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(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
On 19/10/20 13:16, Peter Maydell wrote: > On Mon, 28 Sep 2020 at 17:42, Paolo Bonzini <pbonzini@redhat.com> wrote: >> >> On 28/09/20 18:04, Peter Maydell wrote: >>> 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. > > Could I have a Reviewed-by: if you're happy with this patch? Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/configure b/configure index e8e8e984f24..cd79227d763 100755 --- a/configure +++ b/configure @@ -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
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 <peter.maydell@linaro.org> --- 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(-)