GNOME Bugzilla – Bug 706933
Compilations fails for C++ code using g_settings_schema_* functions
Last modified: 2013-08-28 22:25:11 UTC
Created attachment 253319 [details] Sample C code. Overview: When compiling attached C code with g++ compilation fails, because ld complains about undefined references to g_settings_schema_* functions. Steps to Reproduce: Just try to compile attached code both with gcc and g++, below I provide g++ compilation log: g++ test.c -o test `pkg-config gio-2.0 --cflags --libs` test.c: In function ‘int main()’: test.c:6:5: warning: ‘void g_type_init()’ is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:669) [-Wdeprecated-declarations] g_type_init(); ^ test.c:6:17: warning: ‘void g_type_init()’ is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:669) [-Wdeprecated-declarations] g_type_init(); ^ /tmp/ccNVIz8R.o: In function `main': test.c:(.text+0xe): undefined reference to `g_settings_schema_source_get_default()' test.c:(.text+0x3e): undefined reference to `g_settings_schema_source_ref(_GSettingsSchemaSource*)' test.c:(.text+0x58): undefined reference to `g_settings_schema_source_lookup(_GSettingsSchemaSource*, char const*, int)' test.c:(.text+0xb4): undefined reference to `g_settings_schema_source_unref(_GSettingsSchemaSource*)' collect2: error: ld returned 1 exit status Analogical compilation, but with gcc, results with properly working executable. Additional information: I am running Arch Linux x64 with glib v2.36.4, gcc/g++ v4.8.1, ld v2.23.2
I confirmed, that my GIO library contains g_settings_schema_* functions: readelf -Ws /usr/lib/libgio-2.0.so | grep g_settings_schema 958: 00000000000a45a0 9 FUNC GLOBAL DEFAULT 11 g_settings_schema_ref 1136: 00000000000a4c90 21 FUNC GLOBAL DEFAULT 11 g_settings_schema_source_get_default 1151: 00000000000a4f20 5 FUNC GLOBAL DEFAULT 11 g_settings_schema_get_path 1269: 00000000000a5030 5 FUNC GLOBAL DEFAULT 11 g_settings_schema_get_id 1392: 00000000000a4d40 322 FUNC GLOBAL DEFAULT 11 g_settings_schema_source_lookup 1562: 00000000000a4b00 113 FUNC GLOBAL DEFAULT 11 g_settings_schema_source_get_type 1605: 00000000000a4b80 113 FUNC GLOBAL DEFAULT 11 g_settings_schema_get_type 1606: 00000000000a46e0 92 FUNC GLOBAL DEFAULT 11 g_settings_schema_source_unref 1886: 00000000000a4c00 132 FUNC GLOBAL DEFAULT 11 g_settings_schema_source_new_from_directory 2394: 00000000000a4740 57 FUNC GLOBAL DEFAULT 11 g_settings_schema_unref 2505: 00000000000a4590 9 FUNC GLOBAL DEFAULT 11 g_settings_schema_source_ref Maybe it's GCC bug?
Ok, I figured out, that this issue was already resolved in one of previous commits. *** This bug has been marked as a duplicate of bug 703478 ***