[Spice-devel] [PATCH] server: Fix tests Makefile

Frediano Ziglio fziglio at redhat.com
Thu Jan 7 01:59:58 PST 2016


> 
> As reported in https://bugs.freedesktop.org/show_bug.cgi?id=93520, the
> build from git is failing in Archlinux systems with undefined
> references to glib symbols.
> 
> Instead of using .a static files, using libtool .la solves the problem.
> 
> Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
> ---
>  server/tests/Makefile.am | 35 +++++++++++++++++------------------
>  1 file changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
> index 94a4103..3f1486b 100644
> --- a/server/tests/Makefile.am
> +++ b/server/tests/Makefile.am
> @@ -19,7 +19,6 @@ AM_CPPFLAGS += -DAUTOMATED_TESTS
>  endif
>  
>  LDADD =								\
> -	$(GLIB2_LIBS)						\
>  	$(top_builddir)/spice-common/common/libspice-common.la	\
>  	$(top_builddir)/server/libspice-server.la		\
>  	$(GLIB2_LIBS)						\

This remove a duplicate library and I agree with the change.

Note: some linker (version) are sensible to library order so if you have library
A and B in the command line and an object in A reference a symbol in B you get an
error while if you state library B before library A you don't have the issue.

> @@ -52,11 +51,11 @@ TESTS =	\
>  
>  check_PROGRAMS = $(TESTS)
>  
> -noinst_LIBRARIES = \
> -	libstat_test1.a \
> -	libstat_test2.a \
> -	libstat_test3.a \
> -	libstat_test4.a \
> +noinst_LTLIBRARIES = \
> +	libstat_test1.la \
> +	libstat_test2.la \
> +	libstat_test3.la \
> +	libstat_test4.la \
>  	$(NULL)
>  
>  test_vdagent_SOURCES =		\
> @@ -127,21 +126,21 @@ spice_server_replay_SOURCES = 			\
>  
>  stat_test_SOURCES = stat-main.c
>  stat_test_LDADD = \
> +	libstat_test1.la \
> +	libstat_test2.la \
> +	libstat_test3.la \
> +	libstat_test4.la \
>  	$(LDADD) \
> -	libstat_test1.a \
> -	libstat_test2.a \
> -	libstat_test3.a \
> -	libstat_test4.a \
>  	$(NULL)
>  

I think this piece (changing order) is the real solution to the problem.
It should state test libraries before GLib one in the command line (unless
there is a bug in libtool the change the libraries order).

> -libstat_test1_a_SOURCES = stat-test.c
> -libstat_test1_a_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_COMPRESS_STAT=0
> -DTEST_RED_WORKER_STAT=0 -DTEST_NAME=stat_test1
> +libstat_test1_la_SOURCES = stat-test.c
> +libstat_test1_la_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_COMPRESS_STAT=0
> -DTEST_RED_WORKER_STAT=0 -DTEST_NAME=stat_test1
>  
> -libstat_test2_a_SOURCES = stat-test.c
> -libstat_test2_a_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_COMPRESS_STAT=0
> -DTEST_RED_WORKER_STAT=1 -DTEST_NAME=stat_test2
> +libstat_test2_la_SOURCES = stat-test.c
> +libstat_test2_la_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_COMPRESS_STAT=0
> -DTEST_RED_WORKER_STAT=1 -DTEST_NAME=stat_test2
>  
> -libstat_test3_a_SOURCES = stat-test.c
> -libstat_test3_a_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_COMPRESS_STAT=1
> -DTEST_RED_WORKER_STAT=0 -DTEST_NAME=stat_test3
> +libstat_test3_la_SOURCES = stat-test.c
> +libstat_test3_la_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_COMPRESS_STAT=1
> -DTEST_RED_WORKER_STAT=0 -DTEST_NAME=stat_test3
>  
> -libstat_test4_a_SOURCES = stat-test.c
> -libstat_test4_a_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_COMPRESS_STAT=1
> -DTEST_RED_WORKER_STAT=1 -DTEST_NAME=stat_test4
> +libstat_test4_la_SOURCES = stat-test.c
> +libstat_test4_la_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_COMPRESS_STAT=1
> -DTEST_RED_WORKER_STAT=1 -DTEST_NAME=stat_test4
> --
> 2.5.0
> 

Frediano


More information about the Spice-devel mailing list