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...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo KDE team
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: ---

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]

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 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
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's dependencies
to link dolphin is unnecessary and only a waste of time; they shouldn't

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):

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

    kde-apps/dolphin: Fix build with -flto
    Thanks-to: Alexander Miller <>
    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(+)