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

Submitted by Eduardo Lima (Etrunko) on March 30, 2016, 12:15 p.m.

Details

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

Not browsing as part of any series.

Commit Message

Eduardo Lima (Etrunko) March 30, 2016, 12:15 p.m.
On 03/29/2016 12:08 PM, Mahmood Naderan wrote:
> 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

The new patch attached should fix your issue.

Please apply with the following command:

$ patch -p1 < glib_2_38_compat.patch

Thanks for the report.

Patch hide | download patch | download mbox

diff --git a/tests/test-logging.c b/tests/test-logging.c
index eed149e..32f7b83 100644
--- a/tests/test-logging.c
+++ b/tests/test-logging.c
@@ -43,6 +43,10 @@  LOG_OTHER_HELPER(message, MESSAGE)
 LOG_OTHER_HELPER(warning, WARNING)
 LOG_OTHER_HELPER(critical, CRITICAL)
 
+#ifdef GLIB_VERSION_2_38
+#undef GLIB_VERSION_2_38
+#endif
+#ifdef GLIB_VERSION_2_38
 /* Checks that spice_warning() aborts after changing SPICE_ABORT_LEVEL */
 static void test_spice_abort_level(void)
 {
@@ -376,6 +380,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 +404,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 +418,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();
 }
diff --git a/tests/test-marshallers.c b/tests/test-marshallers.c
index d2c80e5..c2f7547 100644
--- a/tests/test-marshallers.c
+++ b/tests/test-marshallers.c
@@ -4,6 +4,14 @@ 
 #include "common/marshaller.h"
 #include "generated_test_marshallers.h"
 
+#ifndef g_assert_true
+#define g_assert_true(expr)             do { if G_LIKELY (expr) ; else \
+                                               g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
+                                                                    #expr); \
+                                           } while (0)
+#endif
+
+
 static uint8_t expected_data[] = { 0x02, 0x00, 0x00, 0x00, /* data_size */
                                    0x08, 0x00, 0x00, 0x00, /* data offset */
                                    0xef, 0xcd, 0xab, 0x90, 0x78, 0x56, 0x34, 0x12, /* data */

Comments

On 03/30/2016 09:15 AM, Eduardo Lima (Etrunko) wrote:
> On 03/29/2016 12:08 PM, Mahmood Naderan wrote:
>> 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
> 
> The new patch attached should fix your issue.
> 
> Please apply with the following command:
> 
> $ patch -p1 < glib_2_38_compat.patch
> 
> Thanks for the report.
> 

Should be fixed in latest master.
Hi Eduardo,I have to say that the latest git revision doesn't include your patch.  So, I applied your patch manually into the latest revision.
That undefined error has been solved, but now I see a new error.Please note that it is saying I have to include two compiler options. Should I do that or you have a netter idea?

Please see the full log below




root@cluster:spice-src# git rev-parse HEAD
77946c395ba9ff3e6e03386a43f7451ddf1e38a0

root@cluster:spice-src# make -j
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'
  CC     backtrace.lo
  CC     canvas_utils.lo
  CC     lines.lo
  CC     lz.lo
  CC     log.lo
  CC     marshaller.lo
  CC     mem.lo
  CC     pixman_utils.lo
  CC     quic.lo
  CC     region.lo
  CC     snd_codec.lo
  CC     rop3.lo
  CC     ssl_verify.lo
  CC     libspice_common_server_la-generated_server_demarshallers.lo
  CC     libspice_common_server_la-generated_server_marshallers.lo
  CC     generated_client_marshallers.lo
  CC     generated_client_demarshallers.lo
  CC     generated_client_demarshallers1.lo
  CC     generated_client_marshallers1.lo
  CCLD   libspice-common-server.la
  CCLD   libspice-common-client.la
  CCLD   libspice-common.la
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
  CC     test_marshallers-test-marshallers.o
  CC     test_marshallers-generated_test_marshallers.o
test-logging.c: In function 'test_spice_abort_level':
test-logging.c:49: warning: implicit declaration of function 'g_test_subprocess'
test-logging.c:52: warning: implicit declaration of function 'g_test_expect_message'
test-logging.c:56: warning: implicit declaration of function 'g_test_assert_expected_messages'
test-logging.c:60: warning: implicit declaration of function 'g_test_trap_subprocess'
test-logging.c: In function 'test_log_levels':
test-logging.c:204: warning: implicit declaration of function 'g_info'
test-marshallers.c: In function 'main':
test-marshallers.c:31: warning: implicit declaration of function 'g_assert_true'
  CCLD   test_marshallers
  CCLD   test_logging
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]: *** Waiting for unfinished jobs....
test_logging-test-logging.o: In function `test_spice_fatal_critical':
/opt/spice-src/spice-common/tests/test-logging.c:102: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:106: undefined reference to `g_test_trap_subprocess'
test_logging-test-logging.o: In function `test_spice_fatal_return_if_fail':
/opt/spice-src/spice-common/tests/test-logging.c:145: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:149: undefined reference to `g_test_trap_subprocess'
test_logging-test-logging.o: In function `test_spice_fatal_warning':
/opt/spice-src/spice-common/tests/test-logging.c:88: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:92: undefined reference to `g_test_trap_subprocess'
test_logging-test-logging.o: In function `test_spice_non_fatal_g_return_if_fail':
/opt/spice-src/spice-common/tests/test-logging.c:161: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:165: undefined reference to `g_test_trap_subprocess'
test_logging-test-logging.o: In function `test_spice_fatal_g_critical':
/opt/spice-src/spice-common/tests/test-logging.c:131: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:135: undefined reference to `g_test_trap_subprocess'
test_logging-test-logging.o: In function `test_spice_non_fatal_g_critical':
/opt/spice-src/spice-common/tests/test-logging.c:118: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:122: undefined reference to `g_test_trap_subprocess'
test_logging-test-logging.o: In function `test_spice_abort_level_g_warning':
/opt/spice-src/spice-common/tests/test-logging.c:68: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:79: undefined reference to `g_test_trap_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:71: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:75: undefined reference to `g_test_assert_expected_messages'
test_logging-test-logging.o: In function `test_spice_abort_level':
/opt/spice-src/spice-common/tests/test-logging.c:49: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:60: undefined reference to `g_test_trap_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:52: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:56: undefined reference to `g_test_assert_expected_messages'
test_logging-test-logging.o: In function `test_log_levels':
/opt/spice-src/spice-common/tests/test-logging.c:175: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:256: undefined reference to `g_test_trap_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:176: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:180: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:184: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:189: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:193: undefined reference to `g_test_expect_message'
test_logging-test-logging.o:/opt/spice-src/spice-common/tests/test-logging.c:197: more undefined references to `g_test_expect_message' follow
test_logging-test-logging.o: In function `test_log_levels':
/opt/spice-src/spice-common/tests/test-logging.c:204: undefined reference to `g_info'
/opt/spice-src/spice-common/tests/test-logging.c:205: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:210: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:214: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:218: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:222: undefined reference to `g_test_expect_message'
test_logging-test-logging.o:/opt/spice-src/spice-common/tests/test-logging.c:226: more undefined references to `g_test_expect_message' follow
test_logging-test-logging.o: In function `test_log_levels':
/opt/spice-src/spice-common/tests/test-logging.c:231: undefined reference to `g_test_assert_expected_messages'
/opt/spice-src/spice-common/tests/test-logging.c:245: undefined reference to `g_info'
test_logging-test-logging.o: In function `test_spice_g_messages_debug_all':
/opt/spice-src/spice-common/tests/test-logging.c:359: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:374: undefined reference to `g_test_trap_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:365: undefined reference to `g_info'
test_logging-test-logging.o: In function `test_spice_g_messages_debug':
/opt/spice-src/spice-common/tests/test-logging.c:334: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:349: undefined reference to `g_test_trap_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:340: undefined reference to `g_info'
test_logging-test-logging.o: In function `test_spice_debug_level_warning':
/opt/spice-src/spice-common/tests/test-logging.c:295: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:325: undefined reference to `g_test_trap_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:298: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:301: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:305: undefined reference to `g_test_assert_expected_messages'
/opt/spice-src/spice-common/tests/test-logging.c:312: undefined reference to `g_info'
test_logging-test-logging.o: In function `test_spice_debug_level':
/opt/spice-src/spice-common/tests/test-logging.c:264: undefined reference to `g_test_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:285: undefined reference to `g_test_trap_subprocess'
/opt/spice-src/spice-common/tests/test-logging.c:267: undefined reference to `g_test_expect_message'
/opt/spice-src/spice-common/tests/test-logging.c:271: undefined reference to `g_test_assert_expected_messages'
collect2: ld returned 1 exit status
make[5]: *** [test_logging] 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





root@cluster:spice-src# patch -p1 < glib_2_38_compat.patch
can't find file to patch at input line 5
Perhaps you used the wrong -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..32f7b83 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
can't find file to patch at input line 44
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/tests/test-marshallers.c b/tests/test-marshallers.c
|index d2c80e5..c2f7547 100644
|--- a/tests/test-marshallers.c
|+++ b/tests/test-marshallers.c
--------------------------
File to patch: /opt/spice-src/spice-common/tests/test-marshallers.c
patching file /opt/spice-src/spice-common/tests/test-marshallers.c






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
  CC     test_marshallers-test-marshallers.o
  CCLD   test_marshallers
make[5]: Leaving directory `/opt/spice-src/spice-common/tests'
make[4]: Leaving directory `/opt/spice-src/spice-common/tests'
make[4]: Entering directory `/opt/spice-src/spice-common'
make[4]: Leaving directory `/opt/spice-src/spice-common'
make[3]: Leaving directory `/opt/spice-src/spice-common'
make[2]: Leaving directory `/opt/spice-src/spice-common'
Making all in server
make[2]: Entering directory `/opt/spice-src/server'
make  all-recursive
make[3]: Entering directory `/opt/spice-src/server'
Making all in .
make[4]: Entering directory `/opt/spice-src/server'
  CC     agent-msg-filter.lo
cc1: warnings being treated as errors
In file included from red-common.h:40,
                 from agent-msg-filter.c:25:
utils.h: In function 'spice_get_monotonic_time_ms':
utils.h:69: error: implicit declaration of function 'g_get_monotonic_time' [-Wimplicit-function-declaration]
utils.h:69: error: nested extern declaration of 'g_get_monotonic_time' [-Wnested-externs]
In file included from agent-msg-filter.c:27:
reds.h: At top level:
reds.h:35: error: redefinition of typedef 'RedsState'
reds-stream.h:31: note: previous declaration of 'RedsState' was here
In file included from agent-msg-filter.c:28:
red-qxl.h:23: error: redefinition of typedef 'QXLState'
spice-qxl.h:39: note: previous declaration of 'QXLState' was here
make[4]: *** [agent-msg-filter.lo] Error 1
make[4]: Leaving directory `/opt/spice-src/server'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/opt/spice-src/server'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/spice-src/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/spice-src'
make: *** [all] Error 2
root@cluster:spice-src#
 Regards,
Mahmood
On Sat, Apr 02, 2016 at 02:14:11PM +0000, Mahmood Naderan wrote:
> Hi Eduardo,I have to say that the latest git revision doesn't include your patch.  So, I applied your patch manually into the latest revision.
> That undefined error has been solved, but now I see a new error.Please note that it is saying I have to include two compiler options. Should I do that or you have a netter idea?
> 
> Please see the full log below
> 
> 
> 
> 
> root@cluster:spice-src# git rev-parse HEAD
> 77946c395ba9ff3e6e03386a43f7451ddf1e38a0

This does not correspond to a sha1 in the upstream repository.
Things should be good starting from
https://cgit.freedesktop.org/spice/spice-common/commit/?id=6c7552d54369ced08a9b2c61587cad44c04d4ab9

Christophe
Hi,

On Mon, 2016-04-04 at 09:59 +0200, Christophe Fergeau wrote:
> On Sat, Apr 02, 2016 at 02:14:11PM +0000, Mahmood Naderan wrote:
> > 
> > Hi Eduardo,I have to say that the latest git revision doesn't
> > include your patch.  So, I applied your patch manually into the
> > latest revision.
> > That undefined error has been solved, but now I see a new
> > error.Please note that it is saying I have to include two compiler
> > options. Should I do that or you have a netter idea?
> > 
> > Please see the full log below
> > 
> > 
> > 
> > 
> > root@cluster:spice-src# git rev-parse HEAD
> > 77946c395ba9ff3e6e03386a43f7451ddf1e38a0
> This does not correspond to a sha1 in the upstream repository.
> Things should be good starting from
> https://cgit.freedesktop.org/spice/spice-common/commit/?id=6c7552d543
> 69ced08a9b2c61587cad44c04d4ab9

There hasn't been a submodule update which contains that commit, that
is a reason why making spice server fails.

About the 'g_get_monotonic_time' it is available since glib 2.28 and I
think it is reasonable to start requiring it (at least for the unstable
branch). It's been there for five years.

And for the redefinition of typedef's there is a Christophe's patch &
discussion in the mailing list:
https://lists.freedesktop.org/archives/spice-devel/2016-March/027808.ht
ml

Pavel