Bug 103694 - Failure building tests with gcc 7.2.1, missing libm
Summary: Failure building tests with gcc 7.2.1, missing libm
Status: RESOLVED MOVED
Alias: None
Product: Spice
Classification: Unclassified
Component: spice-gtk (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Spice Bug List
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-12 06:17 UTC by Tristan Van Berkom
Modified: 2018-06-03 10:19 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Tristan Van Berkom 2017-11-12 06:17:49 UTC
When building spice-gtk with modern gcc, the tests fail to build with the following error below.

I've tried various combinations and modifications to the tests/Makefile.am to explicitly add `-lm` to LDADD, AM_LDADD, AM_LIBS, etc, and was still unable to come up with a working patch, not sure what's going on here.


    libtool: link: gcc -g -O2 -o test-file-transfer file-transfer.o  -L/usr/lib ../src/.libs/libspice-client-glib-2.0.a -L/usr/lib/x86_64-linux-gnu/mit-krb5 /usr/lib/libgthread-2.0.so -lopus -ljpeg -lpixman-1 -lssl -lcrypto -lpulse-mainloop-glib -lpulse -lsasl2 /usr/lib/libphodav-2.0.so /usr/lib/libsoup-2.4.so -lxml2 /usr/lib/x86_64-linux-gnu/libsqlite3.so -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err /usr/lib/libgio-2.0.so /usr/lib/libgmodule-2.0.so -ldl -lz -lselinux -lresolv /usr/lib/libgobject-2.0.so -lffi /usr/lib/libglib-2.0.so -lpcre -lpthread -pthread
    libtool: link: gcc -g -O2 -o test-pipe pipe.o  -L/usr/lib ../src/.libs/libspice-client-glib-2.0.a -L/usr/lib/x86_64-linux-gnu/mit-krb5 /usr/lib/libgthread-2.0.so -lopus -ljpeg -lpixman-1 -lssl -lcrypto -lpulse-mainloop-glib -lpulse -lsasl2 /usr/lib/libphodav-2.0.so /usr/lib/libsoup-2.4.so -lxml2 /usr/lib/x86_64-linux-gnu/libsqlite3.so -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err /usr/lib/libgio-2.0.so /usr/lib/libgmodule-2.0.so -ldl -lz -lselinux -lresolv /usr/lib/libgobject-2.0.so -lffi /usr/lib/libglib-2.0.so -lpcre -lpthread -pthread
    /usr/bin/ld: ../src/.libs/libspice-client-glib-2.0.a(lines.o): undefined reference to symbol 'hypot@@GLIBC_2.2.5'
    //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
Comment 1 Christophe Fergeau 2017-11-16 14:32:40 UTC
It's spice-common/common/Makefile.am which would need to have -lm, or src/Makefile.am as libspice-client-glib-2.0.a uses hypot() from libm

Something like
diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 68e3091..1bfc116 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -50,6 +50,9 @@ AC_DEFUN([SPICE_CHECK_SYSDEPS], [
     AC_FUNC_ERROR_AT_LINE
     AC_FUNC_FORK
     AC_CHECK_FUNCS([dup2 floor inet_ntoa memmove memset pow sqrt])
+    AC_SEARCH_LIBS([hypot], [m], [], [
+        AC_MSG_ERROR([unable to find the hypot() function])
+    ])
 ])
 
applied in the spice-common subdirectory (+ autogen.sh) should help.
Comment 2 GitLab Migration User 2018-06-03 10:19:55 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/spice/spice-gtk/issues/6.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.