Ticket #246 (closed defect: fixed)
Build fails with --as-needed linker flag
| Reported by: | krissn@… | Owned by: | alwin |
|---|---|---|---|
| Priority: | normal | Milestone: | not applicable |
| Component: | All | Version: | 0.14.x |
| Severity: | tweak | Keywords: | as-needed |
| Cc: |
Description
When building 0.14.1 on Gentoo with LDFLAGS="-Wl,--as-needed" the compilation fails reporting a problem linking the libsvnqt.so library:
Linking CXX shared library ../../lib/libsvnqt.so [ 44%] Building CXX object src/ksvnwidgets/CMakeFiles/ksvnwidgets.dir/authdlg.o [ 44%] Building CXX object src/settings/CMakeFiles/settingsdlgs.dir/diffmergesettings.o CMakeFiles/svnqt.dir/datetime.o: In function `svn::DateTime::SetRFC822Date(char const*)': datetime.cpp:(.text+0x208): undefined reference to `apr_date_parse_rfc' collect2: ld returned 1 exit status make[2]: *** [lib/libsvnqt.so.4.0.0] Błąd 1 make[1]: *** [src/svnqt/CMakeFiles/svnqt.dir/all] Błąd 2 make[1]: *** Oczekiwanie na niezakończone zadania....
The problem appears when apr and apr-utils are linked with --as-needed. The linking command line first includes those libraries with their full LDFLAGS, but due to --as-needed behavior the linker discards them, causing the libraries not to be included in the list of finally required libraries.
The issue is tracked as bug #187318 on Gentoo Bugzilla (http://bugs.gentoo.org/show_bug.cgi?id=187318)
The attached patch fixes the build in my case.
