GNOME Bugzilla – Bug 636105
Linker error when building with gcc-4.5
Last modified: 2010-11-30 08:40:40 UTC
gcc-4.5 has a stricter linking behaviour, where private dependencies of shared libs aren't automatically linked to the program any more; i. e. --as-needed is the default now. http://wiki.debian.org/ToolChain/DSOLinking has some details about this. When building current git head with gcc-4.5: CCLD test_metar /usr/bin/ld.bfd.real: test_metar-test_metar.o: undefined reference to symbol 'g_option_context_parse' /usr/bin/ld.bfd.real: note: 'g_option_context_parse' is defined in DSO /lib64/libglib-2.0.so.0 so try adding it to the linker command line /lib64/libglib-2.0.so.0: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[3]: *** [test_metar] Fehler 1 make[3]: Verlasse Verzeichnis '/home/martin/upstream/libgweather/libgweather' Same for the other two test programs.
Created attachment 175517 [details] [review] git formatted patch Simple patch. OK to push? Thanks, Martin
Comment on attachment 175517 [details] [review] git formatted patch I guess I'd prefer to only link with glib and not gtk for test_metar and test_sun_moon if possible. But I don't care enough to annoy you hard about it ;-) Please commit, thanks!
Right, those are only test programs and as such the linked modules don't matter that much. Also, with gcc 4.5 it won't actually be linked against gtk, since they don't use any GTK symbols (the --as-needed magic). I didn't use GLIB_LIBS because configure.ac doesn't AC_SUBST it, just GTK_LIBS. Pushed, thanks for the review!