After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 636105 - Linker error when building with gcc-4.5
Linker error when building with gcc-4.5
Status: RESOLVED FIXED
Product: libgweather
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: 2.22.0
Assigned To: libgweather-maint
libgweather-maint
Depends on:
Blocks:
 
 
Reported: 2010-11-30 07:30 UTC by Martin Pitt
Modified: 2010-11-30 08:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
git formatted patch (1.33 KB, patch)
2010-11-30 07:31 UTC, Martin Pitt
committed Details | Review

Description Martin Pitt 2010-11-30 07:30:23 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.
Comment 1 Martin Pitt 2010-11-30 07:31:24 UTC
Created attachment 175517 [details] [review]
git formatted patch

Simple patch. OK to push?

Thanks,
Martin
Comment 2 Vincent Untz 2010-11-30 08:34:00 UTC
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!
Comment 3 Martin Pitt 2010-11-30 08:40:27 UTC
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!