[virt-tools-list] virt-viewer fails to build with spice-gtk

Martin Kletzander mkletzan at redhat.com
Thu Mar 13 08:59:58 UTC 2014


On Thu, Mar 13, 2014 at 09:16:00AM +0100, Martin Kletzander wrote:
> Hi everyone.
>
> I'm building virt-viewer from git and for some time I had to have
> commit  d1d53d0c8b5600f61e55e472c592ebc86a65ee6f reverded, but only
> now I got the time to discover why.
>
> I'm building with upstream spice (and spice common and spice-protocol)
> from git and spice-gtk-0.23.  The commit mentioned adds this line of
> code:
>
> #if defined(SPICE_GTK_CHECK_VERSION) && SPICE_GTK_CHECK_VERSION(0, 23, 21)
>
> which looks ok, but in my case there are 2 problems and I don't know
> which one to solve (send patch for) first.  Both are caused by the
> fact that even though configure finds the spice-gtk and everything as
> expected (--with-spice-gtk without problems), the macro
> SPICE_GTK_CHECK_VERSION is not defined.
>
> First question: Is this due to my old spice-gtk (is upstream 0.23
> release too old for this)?
>

My fault, sorry, this really is in spice-gtk only since commit
e124a3b2e8d375661aeed9c151866c46985d7afa, described as
v0.23-22-ge124a3b, i.e. not in 0.23.  Sorry for the noise, I'll send
the rest as a patch.

Martin

> Second problem: That macro not being defined doesn't skip the second
> part of that condition, therefore the compiler complains:
>
> ---8<--------------------------->8---
>
> virt-viewer-session-spice.c: In function 'virt_viewer_session_spice_main_channel_event':
> virt-viewer-session-spice.c:525:64: error: missing binary operator before token "("
>  #if defined(SPICE_GTK_CHECK_VERSION) && SPICE_GTK_CHECK_VERSION(0, 23, 21)
>                                                                 ^
> virt-viewer-session-spice.c:476:19: warning: unused variable 'error'
> [-Wunused-variable] const GError *error;
>                                   ^
> ---8<--------------------------->8---
>
> This should be easily fixable with the following patch (which I'm
> ready to send to the list as a fix), but I would like to know
> beforehand if that's all I need to do or if there's something wrong
> with that macro not being defined as well.
>
> Thank you,
> Martin
>
> diff --git i/src/virt-viewer-session-spice.c w/src/virt-viewer-session-spice.c
> index 1740ba3..fb63c9c 100644
> --- i/src/virt-viewer-session-spice.c
> +++ w/src/virt-viewer-session-spice.c
> @@ -473,7 +473,6 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
>                                               SpiceChannelEvent event,
>                                               VirtViewerSession *session)
>  {
> -    const GError *error;
>      VirtViewerSessionSpice *self = VIRT_VIEWER_SESSION_SPICE(session);
>      gchar *password = NULL, *user = NULL;
>      int ret;
> @@ -522,8 +521,10 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
>          }
>          break;
>      case SPICE_CHANNEL_ERROR_CONNECT:
> -#if defined(SPICE_GTK_CHECK_VERSION) && SPICE_GTK_CHECK_VERSION(0, 23, 21)
> -        error = spice_channel_get_error(channel);
> +#if defined(SPICE_GTK_CHECK_VERSION)
> +# if SPICE_GTK_CHECK_VERSION(0, 23, 21)
> +    {
> +        const GError *error = spice_channel_get_error(channel);
>
>          DEBUG_LOG("main channel: failed to connect %s", error ? error->message : "");
>
> @@ -545,6 +546,11 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
>          } else {
>              g_signal_emit_by_name(session, "session-disconnected");
>          }
> +    }
> +# else
> +        DEBUG_LOG("main channel: failed to connect");
> +        g_signal_emit_by_name(session, "session-disconnected");
> +# endif
>  #else
>          DEBUG_LOG("main channel: failed to connect");
>          g_signal_emit_by_name(session, "session-disconnected");
> --



> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140313/47bcdc56/attachment.sig>


More information about the virt-tools-list mailing list