GNOME Bugzilla – Bug 721783
inline is a C99 keyword, not a GCC extension
Last modified: 2014-01-16 20:57:39 UTC
I build anjuta with clang and it fails in `plugins/symbol-db/benchmark/symbol-db': ../../.libs/libanjuta-symbol-db.so: error: undefined reference to 'sdb_engine_get_statement_by_query_id' ../../.libs/libanjuta-symbol-db.so: error: undefined reference to 'sdb_engine_get_tuple_id_by_unique_name' clang: error: linker command failed with exit code 1 There are also some relevant warning message: symbol-db-engine-utils.c:37:1: warning: inline function 'sdb_engine_get_statement_by_query_id' is not defined [-Wundefined-inline] sdb_engine_get_statement_by_query_id (SymbolDBEngine * dbe, static_query_type query_id); ^ symbol-db-engine-utils.c:102:14: note: used here if ((stmt = sdb_engine_get_statement_by_query_id (dbe, ^ 1 warning generated. It seems gcc treats the inline keyword as a GCC extension, so gcc will generate a external symbol for the inline function. However, clang treats it as a C99 keyword, so clang does not generate a external symbol for it. Maybe `extern inline' should be used instead.
Created attachment 265702 [details] [review] Simple patch file to fix the error
Thank for reporting this and providing a patch but I'm not sure it's the right fix. I have read that extern inline doesn't have the same meaning in GCC and clang. I'm still searching.
Can we add AC_PROG_CC_STDC to configure.ac, so gcc will treats the inline keyword as a C99 keyword?
imho, "inline" should just be dropped here. Let the compiler's optimiser decide if it wants to do it or not.
Created attachment 266397 [details] [review] Remove GNUC_INLINE I think it's better to remove GNUC_INLINE too, so here is a patch doing it. Ting-Wei can you check that it fixes the issue? I don't understand why you get an error sdb_engine_get_tuple_id_by_unique_name. This function is used only inside the file symbol-db-engine.core.c
Yes, the issue can be fixed by the patch.
Thank you, I have committed the fix in the master branch