[Spice-devel] [client] spicy: Spicy uses GTK+ and must link with it

Christophe Fergeau cfergeau at redhat.com
Mon Feb 27 08:19:15 UTC 2017


On Fri, Feb 24, 2017 at 12:23:23PM +0100, Francois Gouget wrote:
> This avoids having the linker complain that gtk_toggle_action_get_type()
> or some other GTK+ API is undefined.

This kind of issues are indeed seen on some distros, and not others.
I believe this is what is described on
https://wiki.mageia.org/en/Underlinking_issues_in_packaging

spicy directly uses symbols from gtk+, so it should explicitly link with
it. This wiki page says this should be reproducible using
-Wl,--as-needed, but this did not make a difference for me as -lgtk-3 is
listed in libspice-client-gtk-3.0.la, and libtool uses this when linking
spicy.

However, spicy-stats uses glib/gobject, and does not explicitly link
with it either, I would have expected something like the patch below, but
this can actually be done on top of your patch.

Acked-by: Christophe Fergeau <cfergeau at redhat.com>
even though I would have liked to be able to reproduce the issue :-/


diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0bdb3c5..0b3df78 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -12,6 +12,12 @@ TOOLS_CPPFLAGS =                     \
        $(SPICE_CFLAGS)                 \
        $(NULL)

+TOOLS_LIBS =                           \
+       $(GLIB2_LIBS)                   \
+       $(GOBJECT2_LIBS)                \
+       $(top_builddir)/src/libspice-client-glib-2.0.la \
+       $(NULL)
+
 if WITH_GTK
 bin_PROGRAMS += spicy
 TOOLS_CPPFLAGS += $(GTK_CFLAGS)
@@ -26,8 +32,9 @@ spicy_SOURCES =                               \
        $(NULL)

 spicy_LDADD =                          \
+       $(TOOLS_LIBS)                   \
+       $(GTK_LIBS)                     \
        $(top_builddir)/src/libspice-client-gtk-3.0.la  \
-       $(top_builddir)/src/libspice-client-glib-2.0.la \
        $(NULL)

 # FIXME: GtkAction and lots of GtkUIManager APIs are deprecated
@@ -44,8 +51,7 @@ spicy_screenshot_SOURCES =            \
        $(NULL)

 spicy_screenshot_LDADD =               \
-       $(top_builddir)/src/libspice-client-glib-2.0.la \
-       $(GOBJECT2_LIBS)                \
+       $(TOOLS_LIBS)                   \
        $(NULL)

 spicy_screenshot_CPPFLAGS =            \
@@ -59,7 +65,7 @@ spicy_stats_SOURCES =                 \
        $(NULL)

 spicy_stats_LDADD =                    \
-       $(top_builddir)/src/libspice-client-glib-2.0.la \
+       $(TOOLS_LIBS)                   \
        $(NULL)

 spicy_stats_CPPFLAGS =                 \


Christophe


> 
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
>  tools/Makefile.am | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/Makefile.am b/tools/Makefile.am
> index 0bdb3c54..e41e0ab5 100644
> --- a/tools/Makefile.am
> +++ b/tools/Makefile.am
> @@ -28,6 +28,7 @@ spicy_SOURCES =				\
>  spicy_LDADD =				\
>  	$(top_builddir)/src/libspice-client-gtk-3.0.la	\
>  	$(top_builddir)/src/libspice-client-glib-2.0.la	\
> +	$(GTK_LIBS) \
>  	$(NULL)
>  
>  # FIXME: GtkAction and lots of GtkUIManager APIs are deprecated
> -- 
> 2.11.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170227/0a8e5915/attachment.sig>


More information about the Spice-devel mailing list