Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 655710 - kde-apps/dolphin-17.12.3 - .../temp/ccHEv6cl.ltrans0.ltrans.o: In function `DBusInterface::~DBusInterface()': <artificial>:(.text+0x2583): undefined reference to `vtable for DBusInterface'
Summary: kde-apps/dolphin-17.12.3 - .../temp/ccHEv6cl.ltrans0.ltrans.o: In function `D...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard: fixed in 18.08
Keywords: PATCH
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2018-05-14 02:44 UTC by Alexander Miller
Modified: 2018-05-24 15:31 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
dolphin-17.12.3-fix-lto-build.patch (dolphin.patch,617 bytes, patch)
2018-05-14 02:44 UTC, Alexander Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Miller 2018-05-14 02:44:18 UTC
Created attachment 531314 [details, diff]
dolphin-17.12.3-fix-lto-build.patch

Building kde-apps/dolphin-17.12.3 fails when C(XX)FLAGS contains -flto with the following error (g++ command simplified for readablility):

[100%] Linking CXX executable dolphin
cd /tmp/portage/kde-apps/dolphin-17.12.3/work/dolphin-17.12.3_build/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/dolphin.dir/link.txt --verbose=1
/usr/bin/x86_64-pc-linux-gnu-g++ -O2 -flto [more flags omitted] CMakeFiles/dolphin.dir/dolphin_dummy.cpp.o CMakeFiles/dolphin.dir/dolphin_autogen/mocs_compilation.cpp.o  -o dolphin libkdeinit5_dolphin.so libdolphinstatic.a [kde/qt libs omitted]
/tmp/portage/kde-apps/dolphin-17.12.3/temp/ccHEv6cl.ltrans0.ltrans.o: In function `DBusInterface::~DBusInterface()':
<artificial>:(.text+0x2583): undefined reference to `vtable for DBusInterface'
/tmp/portage/kde-apps/dolphin-17.12.3/temp/ccHEv6cl.ltrans0.ltrans.o: In function `DBusInterface::~DBusInterface()':
<artificial>:(.text+0x5aa3): undefined reference to `vtable for DBusInterface'
/tmp/portage/kde-apps/dolphin-17.12.3/temp/ccHEv6cl.ltrans0.ltrans.o: In function `kdemain':
<artificial>:(.text+0x7686): undefined reference to `DBusInterface::DBusInterface()'
<artificial>:(.text+0x7b64): undefined reference to `vtable for DBusInterface'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/dolphin.dir/build.make:122: src/dolphin] Error 1
make[2]: Leaving directory '/tmp/portage/kde-apps/dolphin-17.12.3/work/dolphin-17.12.3_build'
make[1]: *** [CMakeFiles/Makefile2:326: src/CMakeFiles/dolphin.dir/all] Error 2
make[1]: Leaving directory '/tmp/portage/kde-apps/dolphin-17.12.3/work/dolphin-17.12.3_build'
make: *** [Makefile:130: all] Error 2
 * ERROR: kde-apps/dolphin-17.12.3::gentoo failed (compile phase):
 *   emake failed

Note that dolphin is just a thin wrapper around libkdeinit5_dolphin.so.
The latter is built from main.cpp, dbusinterface.cpp, and libdolphinstatic.a.
The problem is that dolphin links against the static archive, too, which
contains an extra copy of main.cpp.o (but not dbusinterface.cpp.o).
Normally the extra copy is simply ignored, but with LTO the compiler may
choose to inline kdemain() (from main.cpp) into the dummy main() function.
This fails because the DBusInterface definition is not available. Inlining
kdemain() is undesirable here anyway because that's just unneccessary code
duplication. So the extra copy of main.cpp.o should be removed from the
static archive. Moreover, adding all of libkdeinit5_dolphin.so's dependencies
to link dolphin is unnecessary and only a waste of time; they shouldn't
propagate.

The attached patch fixes both issues, letting the build complete successfully.
For newer versions of dolphin (which I haven't tested) the patch needs
to be (trivially) updated because of changed context.
Comment 1 Andreas Sturmlechner gentoo-dev 2018-05-14 17:18:19 UTC
Please submit this patch upstream. Let me know if you need help with that.
Comment 3 Larry the Git Cow gentoo-dev 2018-05-24 15:31:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=041cd55b5dc192e9e6b1133a08e4279ea3674476

commit 041cd55b5dc192e9e6b1133a08e4279ea3674476
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2018-05-24 15:29:51 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2018-05-24 15:31:21 +0000

    kde-apps/dolphin: Fix build with -flto
    
    Thanks-to: Alexander Miller <alex.miller@gmx.de>
    Closes: https://bugs.gentoo.org/655710
    Package-Manager: Portage-2.3.38, Repoman-2.3.9

 kde-apps/dolphin/dolphin-18.04.1.ebuild           |  2 +
 kde-apps/dolphin/files/dolphin-18.04.1-flto.patch | 96 +++++++++++++++++++++++
 2 files changed, 98 insertions(+)