Recorder integration

Monday, July 10, 2017

Integrating the recorder in Spice on Linux raises a number of unsatisfied symbols:

./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_activate'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_trace_entry'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `ring_peek'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_channel_record'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_spice_debug_record'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_order'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_trace_set'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_tick'

There is also an issue that the GISCAN tool does not know how to deal with ;; as a result from macro termination:

/home/ddd/Work/spice/spice-gtk/spice-common/common/recorder/recorder.h:629: syntax error, unexpected ';' in 'extern struct recorder_info_for_signals recorder_info_for_signals;;' at ';'

The source code contains a macro declaration like:

#define RECORDER_DECLARE(Name) extern struct recorder_##Name recorder_##Name;

and the use case is:

RECORDER_DECLARE(bar);

So that expands to something with two semi-colons, which is perfectly valid in C, but apparently GISCAN chokes on it.

Reduce number of recorder symbols

Did a small refactoring of the flight recorder to minimize code duplication. Now, there is only one place that writes in recorders, and creating a recorder only involves creating a variable that is passed as an argument to these functions.

Other build errors

A few other build errors with spice + recorder on Fedora 26:

  • Function prototypes with () instead of (void) are now flagged as an error under -Wstrict-prototypes:
      ../spice-common/common/recorder/recorder.h:127:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
     typedef size_t (*recorder_readable_fn)();
     ^~~~~~~
    
  • Updated the documentation of the flight recorder to take into account recent changes, remove mentions of limitations that I removed, etc.

I am still running into link errors, though, even with the version of the recorder package that has a reduced number of symbols:

libtool: link: gcc -o /home/ddd/Work/spice/spice-gtk/src/tmp-introspectLww4LC/.libs/SpiceClientGtk-3.0 -g -O2 tmp-introspectLww4LC/home/ddd/Work/spice/spice-gtk/src/tmp-introspectLww4LC/SpiceClientGtk-3.0.o -Wl,--export-dynamic -pthread -Wl,--export-dynamic  -L. ./.libs/libspice-client-gtk-3.0.so /home/ddd/Work/spice/spice-gtk/src/.libs/libspice-client-glib-2.0.so -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgdk_pixbuf-2.0 -lepoxy -lcairo -lX11 ./.libs/libspice-client-glib-2.0.so -lcelt051 -lm -lgthread-2.0 -lopus -ljpeg -lz -llz4 -lpixman-1 -lssl -lcrypto -lpulse-mainloop-glib -lpulse -lgstaudio-1.0 -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -lsasl2 -lcacard -lusb-1.0 -lusbredirhost -lusbredirparser -lphodav-2.0 -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -pthread -Wl,-rpath -Wl,/usr/local/lib
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_activate'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_append'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_append2'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_append3'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_trace_set'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_info_for_channel'
./.libs/libspice-client-gtk-3.0.so: undefined reference to `recorder_info_for_spice_debug'