Spice-GTK for Mac - Recovered from old notes

Wednesday, March 8, 2017

Spice for Mac is at Red Hat Bugzilla 728618.

Server side

Fixed the autoconf issue, see GNU bug report

Missing Libtool. Installing with Homebrew fixes it.

Missing celt051. Not in Homebrew.

This

patch maye be inspiration, shows what to replace it with.

spice-gtk

configure.ac:16: warning: AM_NLS is m4_require'd but not m4_defun'd

Fixed by creating /usr/local/share/aclocal/nls.m4 as described here. This is a rather annoying workaround.

configure: error: GNU gettext tools not found; required for intltool

Fixed with: export PATH=$PATH:/usr/local/Cellar/gettext/0.19.8.1/bin

configure: error: libjpeg not found

Fixed with: CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib (both are necessary, even though the test looks like a preprocessor test)

Configure works after that, though it complains about audio:

configure: WARNING: No PulseAudio or GStreamer 1.0 audio decoder, audio will not be streamed

Then make fails:

Making all in common
  GEN      generated_client_demarshallers.c

Traceback (most recent call last): File "../spice_codegen.py", line 7, in from python_modules import spice_parser File "/Users/ddd/Work/spice/spice-gtk/spice-common/python_modules/spice_parser.py", line 1, in import six ImportError: No module named six

Fixed with: pip install six

Making all in python_modules

Making all in common GEN generated_client_demarshallers.c

Fixed with: pip install pyparsing

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I.. -I/usr/local/Cellar/pixman/0.34.0/include/pixman-1 -D_REENTRANT -I/usr/local/Cellar/glib/2.50.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include -I/usr/local/include/spice-1 -I/usr/local/include -g -O2 -MT ssl_verify.lo -MD -MP -MF .deps/ssl_verify.Tpo -c ssl_verify.c  -fno-common -DPIC -o .libs/ssl_verify.o

In file included from ssl_verify.c:24: ./ssl_verify.h:31:10: fatal error: 'openssl/rsa.h' file not found #include

Fixed with:

CPPFLAGS="-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2j/include " LDFLAGS="-L/usr/local/lib -L/usr/local/openssl/1.0.2j/lib"  ./configure

  CCLD     test_logging

ld: warning: directory not found for option '-L/usr/local/openssl/1.0.2j/lib' ld: library not found for -lssl

Fixed? with:

CPPFLAGS="-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2j/include " LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/openssl/1.0.2j/lib"  ./configure

(Forgot 'Cellar' for link directory)

make[4]: Entering directory `/Users/ddd/Work/spice/spice-gtk/src/controller'

  *** Error: missing valac!
  *** You must run autogen.sh or configure --enable-vala

Asked the question about valac on mailing list.

Trying:

CPPFLAGS="-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2j/include " LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/openssl/1.0.2j/lib"  ./configure --enable-vala"

checking for valac... valac

configure: WARNING: no proper vala compiler found configure: WARNING: you will not be able to compile vala source files checking for vapigen... no configure: error: Cannot find the "vapigen" binary in your PATH

Fix: brew install vala

  CC       spice-audio.lo

In file included from spice-audio.c:42: In file included from ./spice-channel-priv.h:32: In file included from ./coroutine.h:27: In file included from ./continuation.h:25: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/ucontext.h:43:2: error: The deprecated ucontext routines require _XOPEN_SOURCE to be defined #error The deprecated ucontext routines require _XOPEN_SOURCE to be defined ^

Deprecated in OSX. Trying:

CPPFLAGS="-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2j/include " LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/openssl/1.0.2j/lib"  ./configure --enable-vala --with-coroutine=gthread

This works. PATCH configure.ac like this:

diff --git a/configure.ac b/configure.ac

index 763d14b..53f9c4f 100644 --- a/configure.ac +++ b/configure.ac @@ -460,6 +460,8 @@ esac if test "$with_coroutine" = "auto"; then if test "$os_win32" = "yes"; then with_coroutine=winfiber + elif test "$os_mac" = "yes"; then + with_coroutine=gthread else with_coroutine=ucontext fi

spice-channel.c:1350:10: error: cast from 'uint8_t *' (aka 'unsigned char *') to
      'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to
      4 [-Werror,-Wcast-align]
        *(uint32_t *)p = GUINT32_TO_LE(g_array_index(c->common_caps, uin...
         ^~~~~~~~~~~~~

spice-channel.c:1354:10: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] *(uint32_t *)p = GUINT32_TO_LE(g_array_index(c->caps, uint32_t, i)); ^~~~~~~~~~~~~ spice-channel.c:1919:12: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] ...(uint32_t *)((uint8_t *)c->peer_msg + GUINT32_FROM_LE(c->peer_msg->caps_offset)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixed by adding a (void *) in these casts. Implemented with SPICE_REALIGN_CAST macro.

See also Frediano's approach of the same problem (clang-ism).

channel-display-mjpeg.c:110:2: error: "You should consider building with libjpeg-turbo" [-Werror,-W#warnings]

#warning "You should consider building with libjpeg-turbo" ^

Fix 1:

brew install jpeg-turbo
Fix 2:
CPPFLAGS="-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2j/include -I/usr/local/opt/jpeg-turbo/include" LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/openssl/1.0.2j/lib -L/usr/local/opt/jpeg-turbo/lib"  ./configure --enable-vala 

No turbo-jpeg...

Fix 3:

CPPFLAGS="-I/usr/local/opt/jpeg-turbo/include -I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2j/include" LDFLAGS="-L/usr/local/opt/jpeg-turbo/lib -L/usr/local/lib -L/usr/local/Cellar/openssl/1.0.2j/lib"  ./configure --enable-vala