All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-5.2] configure: Make "does libgio work" test pull in some actual functions
@ 2020-11-16 10:46 Peter Maydell
  2020-11-16 18:25 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2020-11-16 10:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

In commit 76346b6264a9b01979 we tried to add a configure check that
the libgio pkg-config data was correct, which builds an executable
linked against it.  Unfortunately this doesn't catch the problem
(missing static library dependency info), because a "do nothing" test
source file doesn't have any symbol references that cause the linker
to pull in .o files from libgio.a, and so we don't see the "missing
symbols from libmount" error that a full QEMU link triggers.

(The ineffective test went unnoticed because of a typo that
effectively disabled libgio unconditionally, but after commit
3569a5dfc11f2 fixed that, a static link of the system emulator on
Ubuntu stopped working again.)

Improve the gio test by having the test source fragment reference a
g_dbus function (which is what is indirectly causing us to end up
wanting functions from libmount).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
The ideal thing here might perhaps be to force the linker to
pull in everything in the library rather than trusting that
this particular function is sufficient to trigger the need
for libmount functions, but annoyingly gcc and clang
have different command line options to do that.

 configure | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 4cef321d9dc..2717cf1db0a 100755
--- a/configure
+++ b/configure
@@ -3512,8 +3512,15 @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
     # 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
+    cat > $TMPC <<EOF
+#include <gio/gio.h>
+int main(void)
+{
+    g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
+    return 0;
+}
+EOF
+    if compile_prog "$gio_cflags" "$gio_libs" ; then
         gio=yes
     else
         gio=no
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH for-5.2] configure: Make "does libgio work" test pull in some actual functions
  2020-11-16 10:46 [PATCH for-5.2] configure: Make "does libgio work" test pull in some actual functions Peter Maydell
@ 2020-11-16 18:25 ` Paolo Bonzini
  2020-11-17 11:44   ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2020-11-16 18:25 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel

On 16/11/20 11:46, Peter Maydell wrote:
> In commit 76346b6264a9b01979 we tried to add a configure check that
> the libgio pkg-config data was correct, which builds an executable
> linked against it.  Unfortunately this doesn't catch the problem
> (missing static library dependency info), because a "do nothing" test
> source file doesn't have any symbol references that cause the linker
> to pull in .o files from libgio.a, and so we don't see the "missing
> symbols from libmount" error that a full QEMU link triggers.
> 
> (The ineffective test went unnoticed because of a typo that
> effectively disabled libgio unconditionally, but after commit
> 3569a5dfc11f2 fixed that, a static link of the system emulator on
> Ubuntu stopped working again.)
> 
> Improve the gio test by having the test source fragment reference a
> g_dbus function (which is what is indirectly causing us to end up
> wanting functions from libmount).
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> The ideal thing here might perhaps be to force the linker to
> pull in everything in the library rather than trusting that
> this particular function is sufficient to trigger the need
> for libmount functions, but annoyingly gcc and clang
> have different command line options to do that.
> 
>   configure | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index 4cef321d9dc..2717cf1db0a 100755
> --- a/configure
> +++ b/configure
> @@ -3512,8 +3512,15 @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
>       # 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
> +    cat > $TMPC <<EOF
> +#include <gio/gio.h>
> +int main(void)
> +{
> +    g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
> +    return 0;
> +}
> +EOF
> +    if compile_prog "$gio_cflags" "$gio_libs" ; then
>           gio=yes
>       else
>           gio=no
> 

Looks good,

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH for-5.2] configure: Make "does libgio work" test pull in some actual functions
  2020-11-16 18:25 ` Paolo Bonzini
@ 2020-11-17 11:44   ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-11-17 11:44 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On Mon, 16 Nov 2020 at 18:25, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 16/11/20 11:46, Peter Maydell wrote:
> > In commit 76346b6264a9b01979 we tried to add a configure check that
> > the libgio pkg-config data was correct, which builds an executable
> > linked against it.  Unfortunately this doesn't catch the problem
> > (missing static library dependency info), because a "do nothing" test
> > source file doesn't have any symbol references that cause the linker
> > to pull in .o files from libgio.a, and so we don't see the "missing
> > symbols from libmount" error that a full QEMU link triggers.
> >
> > (The ineffective test went unnoticed because of a typo that
> > effectively disabled libgio unconditionally, but after commit
> > 3569a5dfc11f2 fixed that, a static link of the system emulator on
> > Ubuntu stopped working again.)
> >
> > Improve the gio test by having the test source fragment reference a
> > g_dbus function (which is what is indirectly causing us to end up
> > wanting functions from libmount).
> >
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> > The ideal thing here might perhaps be to force the linker to
> > pull in everything in the library rather than trusting that
> > this particular function is sufficient to trigger the need
> > for libmount functions, but annoyingly gcc and clang
> > have different command line options to do that.
> >
> >   configure | 11 +++++++++--
> >   1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 4cef321d9dc..2717cf1db0a 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3512,8 +3512,15 @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
> >       # 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
> > +    cat > $TMPC <<EOF
> > +#include <gio/gio.h>
> > +int main(void)
> > +{
> > +    g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
> > +    return 0;
> > +}
> > +EOF
> > +    if compile_prog "$gio_cflags" "$gio_libs" ; then
> >           gio=yes
> >       else
> >           gio=no
> >
>
> Looks good,
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Thanks; applied to target-arm.next for 5.2.

-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH for-5.2?] configure: Make "does libgio work" test pull in some actual functions
@ 2020-11-12 16:52 Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-11-12 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

In commit 76346b6264a9b01979 we tried to add a configure check that
the libgio pkg-config data was correct, which builds an executable
linked against it.  Unfortunately this doesn't catch the problem
(missing static library dependency info), because a "do nothing" test
source file doesn't have any symbol references that cause the linker
to pull in .o files from libgio.a, and so we don't see the "missing
symbols from libmount" error that a full QEMU link triggers.

(The ineffective test went unnoticed because of a typo that
effectively disabled libgio unconditionally, but after commit
3569a5dfc11f2 fixed that, a static link of the system emulator on
Ubuntu stopped working again.)

Improve the gio test by having the test source fragment reference a
g_dbus function (which is what is indirectly causing us to end up
wanting functions from libmount).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 4cef321d9dc..2717cf1db0a 100755
--- a/configure
+++ b/configure
@@ -3512,8 +3512,15 @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
     # 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
+    cat > $TMPC <<EOF
+#include <gio/gio.h>
+int main(void)
+{
+    g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
+    return 0;
+}
+EOF
+    if compile_prog "$gio_cflags" "$gio_libs" ; then
         gio=yes
     else
         gio=no
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-17 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 10:46 [PATCH for-5.2] configure: Make "does libgio work" test pull in some actual functions Peter Maydell
2020-11-16 18:25 ` Paolo Bonzini
2020-11-17 11:44   ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2020-11-12 16:52 [PATCH for-5.2?] " Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.