[Spice-devel] "undefined reference" errors while running make

Submitted by Eduardo Lima (Etrunko) on March 29, 2016, 1:32 p.m.

Details

Message ID 56FA83E3.7050002@redhat.com
State New
Headers show
Series ""undefined reference" errors while running make" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Eduardo Lima (Etrunko) March 29, 2016, 1:32 p.m.
On 03/29/2016 09:54 AM, Mahmood Naderan wrote:
>>What is the version of glib in your system?
>>Those functions were added in version 2.38.
> 
> OK. Currently I am using Centos-6.5 which is rather old.
> Anyway thanks...
>  

I am working on a patch to fix this error in older systems, such as
RHEL6 and CentOS equivalent. Can you try the patch attached?

Regards, Eduardo.

Patch hide | download patch | download mbox

diff --git a/tests/test-logging.c b/tests/test-logging.c
index eed149e..69eff24 100644
--- a/tests/test-logging.c
+++ b/tests/test-logging.c
@@ -43,6 +43,7 @@  LOG_OTHER_HELPER(message, MESSAGE)
 LOG_OTHER_HELPER(warning, WARNING)
 LOG_OTHER_HELPER(critical, CRITICAL)
 
+#ifdef GLIB_VERSION_2_38
 /* Checks that spice_warning() aborts after changing SPICE_ABORT_LEVEL */
 static void test_spice_abort_level(void)
 {
@@ -376,6 +377,7 @@  static void test_spice_g_messages_debug_all(void)
     g_test_trap_assert_stdout("*spice_debug\n*spice_info\n*g_debug\n*g_info\n*other_debug\n*other_info\n");
     g_test_trap_assert_stderr("*g_message\n*other_message\n");
 }
+#endif /* GLIB_VERSION_2_38 */
 
 static void handle_sigabrt(int sig)
 {
@@ -399,6 +401,7 @@  int main(int argc, char **argv)
      * test cases are going to test */
     g_log_set_always_fatal(fatal_mask & G_LOG_LEVEL_MASK);
 
+#ifdef GLIB_VERSION_2_38
     g_test_add_func("/spice-common/spice-abort-level", test_spice_abort_level);
     g_test_add_func("/spice-common/spice-abort-level-gwarning", test_spice_abort_level_g_warning);
     g_test_add_func("/spice-common/spice-debug-level", test_spice_debug_level);
@@ -412,6 +415,7 @@  int main(int argc, char **argv)
     g_test_add_func("/spice-common/spice-fatal-return-if-fail", test_spice_fatal_return_if_fail);
     g_test_add_func("/spice-common/spice-non-fatal-greturn-if-fail", test_spice_non_fatal_g_return_if_fail);
     g_test_add_func("/spice-common/spice-fatal-warning", test_spice_fatal_warning);
+#endif /* GLIB_VERSION_2_38 */
 
     return g_test_run();
 }

Comments

O that is good :thumsup:I applied the patch and the compilation passed that file. However, I get a new undefined reference in another file

root@cluster:spice-src# patch < patch
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/tests/test-logging.c b/tests/test-logging.c
|index eed149e..69eff24 100644
|--- a/tests/test-logging.c
|+++ b/tests/test-logging.c
--------------------------
File to patch: /opt/spice-src/spice-common/tests/test-logging.c
patching file /opt/spice-src/spice-common/tests/test-logging.c
root@cluster:spice-src#
root@cluster:spice-src#
root@cluster:spice-src#
root@cluster:spice-src# make
make  all-recursive
make[1]: Entering directory `/opt/spice-src'
Making all in spice-common
make[2]: Entering directory `/opt/spice-src/spice-common'
make  all-recursive
make[3]: Entering directory `/opt/spice-src/spice-common'
Making all in python_modules
make[4]: Entering directory `/opt/spice-src/spice-common/python_modules'
make[4]: Leaving directory `/opt/spice-src/spice-common/python_modules'
Making all in common
make[4]: Entering directory `/opt/spice-src/spice-common/common'
make  all-am
make[5]: Entering directory `/opt/spice-src/spice-common/common'
make[5]: Nothing to be done for `all-am'.
make[5]: Leaving directory `/opt/spice-src/spice-common/common'
make[4]: Leaving directory `/opt/spice-src/spice-common/common'
Making all in tests
make[4]: Entering directory `/opt/spice-src/spice-common/tests'
make  all-am
make[5]: Entering directory `/opt/spice-src/spice-common/tests'
  CC     test_logging-test-logging.o
  CCLD   test_logging
  CCLD   test_marshallers
test_marshallers-test-marshallers.o: In function `main':
/opt/spice-src/spice-common/tests/test-marshallers.c:31: undefined reference to `g_assert_true'
collect2: ld returned 1 exit status
make[5]: *** [test_marshallers] Error 1
make[5]: Leaving directory `/opt/spice-src/spice-common/tests'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/opt/spice-src/spice-common/tests'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/opt/spice-src/spice-common'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/spice-src/spice-common'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/spice-src'
make: *** [all] Error 2

 Regards,
Mahmood