Bug 397653 - Linking dolphin fails on NixOS
Summary: Linking dolphin fails on NixOS
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 18.08.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-20 11:25 UTC by Bastian Köcher
Modified: 2018-08-23 18:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Linker error on NixOS (73.05 KB, text/plain)
2018-08-20 11:25 UTC, Bastian Köcher
Details
Log with make VERBOSE=1 (2.33 MB, text/plain)
2018-08-21 12:49 UTC, Bastian Köcher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bastian Köcher 2018-08-20 11:25:54 UTC
Created attachment 114515 [details]
Linker error on NixOS

Hi,
while updating the packages on NixOS for kde applications 18.08, I encountered a problem with linking dolphin (see attached log for full build log):

[ 99%] Building CXX object src/CMakeFiles/dolphin.dir/dolphin_dummy.cpp.o
[100%] Building CXX object src/CMakeFiles/dolphin.dir/dolphin_autogen/mocs_compilation.cpp.o
[100%] Linking CXX executable ../bin/dolphin
/nix/store/gpc2wld1s0c6qzx9326cwn1wcx29xzsj-binutils-2.30/bin/ld: warning: libdolphinprivate.so.5, needed by ../bin/libkdeinit5_dolphin.so, not found (try using -rpath or -rpath-link)
/nix/store/gpc2wld1s0c6qzx9326cwn1wcx29xzsj-binutils-2.30/bin/ld: warning: libdolphinvcs.so.5, needed by ../bin/libkdeinit5_dolphin.so, not found (try using -rpath or -rpath-link)
../bin/libkdeinit5_dolphin.so: undefined reference to `KItemListView::dragMoveEvent(QGraphicsSceneDragDropEvent*)'
../bin/libkdeinit5_dolphin.so: undefined reference to `KItemListView::createDragPixmap(KItemSet const&) const'
../bin/libkdeinit5_dolphin.so: undefined reference to `DolphinView::itemCountChanged()'

I could track this problem down to the following commit: https://phabricator.kde.org/D12931
Removing this patch, resolves the linking error.

I looked into the documentation of CMake, but I don't have any idea what could be wrong. It should propagate the `libdolphinprivate.so.5` and `libdolphinvcs.so.5` libraries as required libraries for linking.
Comment 1 Elvis Angelaccio 2018-08-20 14:58:12 UTC
I guess we can just revert that change, but would be nice to understand what's the problem. 

Can you build with `make VERBOSE=1` and show the content of the file `src/CMakeFiles/dolphin.dir/link.txt` (from your build folder) ?

This is what I get on my system:

With commit 8e6f4eecd3 applied:

/usr/bin/c++   -std=c++0x -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -pedantic -Wsuggest-override -Wlogical-op -Wzero-as-null-pointer-constant  -Wl,--enable-new-dtags  -rdynamic CMakeFiles/dolphin.dir/dolphin_dummy.cpp.o CMakeFiles/dolphin.dir/dolphin_autogen/mocs_compilation.cpp.o  -o ../bin/dolphin -Wl,-rpath,/home/elvis/dev/kde/dolphin/build/bin: ../bin/libkdeinit5_dolphin.so


With commit 8e6f4eecd3 reverted:

/usr/bin/c++   -std=c++0x -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -pedantic -Wsuggest-override -Wlogical-op -Wzero-as-null-pointer-constant  -Wl,--enable-new-dtags  -rdynamic CMakeFiles/dolphin.dir/dolphin_dummy.cpp.o CMakeFiles/dolphin.dir/dolphin_autogen/mocs_compilation.cpp.o  -o ../bin/dolphin -Wl,-rpath,/home/elvis/dev/kde/dolphin/build/bin: ../bin/libkdeinit5_dolphin.so ../lib/libdolphinstatic.a /usr/lib/libKF5KCMUtils.so.5.49.0 /usr/lib/libKF5Notifications.so.5.49.0 /usr/lib/libphonon4qt5.so.4.10.1 /usr/lib/libKF5Activities.so.5.49.0 ../bin/libdolphinprivate.so.5.0.0 ../bin/libdolphinvcs.so.5.0.0 /usr/lib/libKF5Crash.so.5.49.0 /usr/lib/libKF5KIOFileWidgets.so.5.49.0 /usr/lib/libKF5Bookmarks.so.5.49.0 /usr/lib/libKF5NewStuff.so.5.49.0 /usr/lib/libKF5NewStuffCore.so.5.49.0 /usr/lib/libKF5Parts.so.5.49.0 /usr/lib/libKF5KIOWidgets.so.5.49.0 /usr/lib/libKF5JobWidgets.so.5.49.0 /usr/lib/libKF5XmlGui.so.5.49.0 /usr/lib/libKF5TextWidgets.so.5.49.0 /usr/lib/libKF5IconThemes.so.5.49.0 /usr/lib/libKF5Completion.so.5.49.0 /usr/lib/libKF5SonnetUi.so.5.49.0 /usr/lib/libKF5ConfigWidgets.so.5.49.0 /usr/lib/libKF5Codecs.so.5.49.0 /usr/lib/libKF5ItemViews.so.5.49.0 /usr/lib/libKF5Attica.so.5.49.0 /usr/lib/libKF5BalooWidgets.so.18.8.0 /usr/lib/libKF5KIOCore.so.5.49.0 /usr/lib/libQt5Concurrent.so.5.11.1 /usr/lib/libKF5Service.so.5.49.0 /usr/lib/libKF5DBusAddons.so.5.49.0 /usr/lib/libQt5Network.so.5.11.1 /usr/lib/libKF5Auth.so.5.49.0 /usr/lib/libKF5Baloo.so.5.49.0 /usr/lib/libKF5FileMetaData.so.5.49.0 /usr/lib/libKF5Solid.so.5.49.0 /usr/lib/libQt5DBus.so.5.11.1 /usr/lib/libKF5I18n.so.5.49.0 /usr/lib/libKF5CoreAddons.so.5.49.0 /usr/lib/libKF5WidgetsAddons.so.5.49.0 /usr/lib/libQt5Widgets.so.5.11.1 /usr/lib/libKF5ConfigGui.so.5.49.0 /usr/lib/libQt5Gui.so.5.11.1 /usr/lib/libKF5ConfigCore.so.5.49.0 /usr/lib/libQt5Xml.so.5.11.1 /usr/lib/libQt5Core.so.5.11.1
Comment 2 Elvis Angelaccio 2018-08-20 15:23:09 UTC
Actually, it's the libkdeinit5_dolphin.so target that fails to link, so `src/CMakeFiles/kdeinit_dolphin.dir/link.txt` should also be checked
Comment 3 Elvis Angelaccio 2018-08-20 16:33:31 UTC
Looking at it again, commit 8e6f4eecd3 looks correct: the kdeinit_dolphin cmake target is a shared library made by main.cpp and dbusinterface.cpp. We only have dbusinterface.h as header, which doesn't have #includes to files provided by libdolphinprivate. That means that using PRIVATE should definitely work.
Comment 4 Elvis Angelaccio 2018-08-20 16:37:01 UTC
(In reply to Bastian Köcher from comment #0)
> [100%] Linking CXX executable ../bin/dolphin
> /nix/store/gpc2wld1s0c6qzx9326cwn1wcx29xzsj-binutils-2.30/bin/ld: warning:
> libdolphinprivate.so.5, needed by ../bin/libkdeinit5_dolphin.so, not found
> (try using -rpath or -rpath-link)
> /nix/store/gpc2wld1s0c6qzx9326cwn1wcx29xzsj-binutils-2.30/bin/ld: warning:
> libdolphinvcs.so.5, needed by ../bin/libkdeinit5_dolphin.so, not found (try
> using -rpath or -rpath-link)

I wonder why you have these warnings. It's also not finding libdolphinvcs.so.5, which shouldn't be related to commit 8e6f4eecd3. So it could be that there is another build issue that was previously hidden (by having libdolphinprivate marked as a PUBLIC dependency of libkdeinit5_dolphin).
Comment 5 Bastian Köcher 2018-08-21 12:49:30 UTC
Created attachment 114530 [details]
Log with make VERBOSE=1
Comment 6 Bastian Köcher 2018-08-21 12:53:04 UTC
`src/CMakeFiles/dolphin.dir/link.txt`:
/nix/store/jlbpa06dm81jvbb9jklf5dgvxxad6lgd-gcc-wrapper-7.3.0/bin/g++   -std=c++0x -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -pedantic -Wsuggest-override -Wlogical-op -Wzero-as-null-pointer-constant -O3 -DNDEBUG  -Wl,--enable-new-dtags  -rdynamic CMakeFiles/dolphin.dir/dolphin_dummy.cpp.o CMakeFiles/dolphin.dir/dolphin_autogen/mocs_compilation.cpp.o  -o ../bin/dolphin -Wl,-rpath,::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../bin/libkdeinit5_dolphin.so 

`src/CMakeFiles/kdeinit_dolphin.dir/link.txt`
/nix/store/jlbpa06dm81jvbb9jklf5dgvxxad6lgd-gcc-wrapper-7.3.0/bin/g++ -fPIC  -std=c++0x -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -pedantic -Wsuggest-override -Wlogical-op -Wzero-as-null-pointer-constant -O3 -DNDEBUG -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--enable-new-dtags  -shared -Wl,-soname,libkdeinit5_dolphin.so -o ../bin/libkdeinit5_dolphin.so CMakeFiles/kdeinit_dolphin.dir/dbusinterface.cpp.o CMakeFiles/kdeinit_dolphin.dir/main.cpp.o CMakeFiles/kdeinit_dolphin.dir/kdeinit_dolphin_autogen/mocs_compilation.cpp.o -Wl,-rpath,::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../lib/libdolphinstatic.a ../bin/libdolphinprivate.so.5.0.0 ../bin/libdolphinvcs.so.5.0.0 /nix/store/fx94is4r5mxiqbm22l86bvqy1dfs7qa0-kcrash-5.49.0/lib/libKF5Crash.so.5.49.0 /nix/store/im6g9ich9jqhwr159y4i3z8fgxcwibsq-kio-5.49.0/lib/libKF5KIOFileWidgets.so.5.49.0 /nix/store/2cax86sk1547mcd0sq0xdlir16js1vsz-kbookmarks-5.49.0/lib/libKF5Bookmarks.so.5.49.0 /nix/store/n9ayqzvyfxw2jblzr6g1xq3afkhwn1i8-knewstuff-5.49.0/lib/libKF5NewStuff.so.5.49.0 /nix/store/n9ayqzvyfxw2jblzr6g1xq3afkhwn1i8-knewstuff-5.49.0/lib/libKF5NewStuffCore.so.5.49.0 /nix/store/3ykqgj44j1a7ksp7njgk9y7gmghz184g-kparts-5.49.0/lib/libKF5Parts.so.5.49.0 /nix/store/im6g9ich9jqhwr159y4i3z8fgxcwibsq-kio-5.49.0/lib/libKF5KIOWidgets.so.5.49.0 /nix/store/fy3fxrclgybjr038c58rx1x24h8xdf88-kjobwidgets-5.49.0/lib/libKF5JobWidgets.so.5.49.0 /nix/store/9a0gyj8w3nyxlkp6sjj8j87rbd147bjd-baloo-widgets-18.08.0/lib/libKF5BalooWidgets.so.18.8.0 /nix/store/im6g9ich9jqhwr159y4i3z8fgxcwibsq-kio-5.49.0/lib/libKF5KIOCore.so.5.49.0 /nix/store/rgmxlirba45ji77rj90569nid54cfhh0-qtbase-5.11.1/lib/libQt5Concurrent.so.5.11.1 /nix/store/z23gp4mkz7j85mxjmffmk92g4ydzizgb-baloo-5.49.0/lib/libKF5Baloo.so.5.49.0 /nix/store/dxnks3drsjfb0yayr842zkc7f3zavgqr-kfilemetadata-5.49.0/lib/libKF5FileMetaData.so.5.49.0 /nix/store/yaq23nlpsvw17jvfcn02g40i4frl24jd-solid-5.49.0/lib/libKF5Solid.so.5.49.0 /nix/store/cq7yh1sz4yablil60c5wjspp9cybvbmk-kcmutils-5.49.0/lib/libKF5KCMUtils.so.5.49.0 /nix/store/mwlyd9kh8gvmc2fjpg070dc4p5kvb15x-kxmlgui-5.49.0/lib/libKF5XmlGui.so.5.49.0 /nix/store/63952cnvz0m3gwqkgwkif07sr2hcxqgm-ktextwidgets-5.49.0/lib/libKF5TextWidgets.so.5.49.0 /nix/store/anahpi4kpib8rzxxhvmzqz14lags8ia4-kiconthemes-5.49.0/lib/libKF5IconThemes.so.5.49.0 /nix/store/r23c3iky9gm4wxr2n1fy7palsdjjx8fm-kcompletion-5.49.0/lib/libKF5Completion.so.5.49.0 /nix/store/sx3ddjxsw7hib2p3yym7xjwm620s9bmf-kservice-5.49.0/lib/libKF5Service.so.5.49.0 /nix/store/mzrr9h01ywpjq6d473cfbc5svlgmcs0w-sonnet-5.49.0/lib/libKF5SonnetUi.so.5.49.0 /nix/store/2l2fbm8jgvlvh9pw0ni66kl2gxmlplys-kconfigwidgets-5.49.0/lib/libKF5ConfigWidgets.so.5.49.0 /nix/store/hhhqzclhbv1rsvk02xmp30bwbskngc5l-ki18n-5.49.0/lib/libKF5I18n.so.5.49.0 /nix/store/bnqjxlmddhkznv1ibx7dddzq7hh3b430-kconfig-5.49.0/lib/libKF5ConfigGui.so.5.49.0 /nix/store/qav3w2jjp0wh423czqkkglmkhx87vykf-kauth-5.49.0/lib/libKF5Auth.so.5.49.0 /nix/store/3pglssiwr69qd747i1fc953hk8k4jbhg-kwidgetsaddons-5.49.0/lib/libKF5WidgetsAddons.so.5.49.0 /nix/store/b7raygmj239yk51cmsfb8891pkwsws70-kitemviews-5.49.0/lib/libKF5ItemViews.so.5.49.0 /nix/store/rgmxlirba45ji77rj90569nid54cfhh0-qtbase-5.11.1/lib/libQt5Xml.so.5.11.1 /nix/store/bzx0wr9n4wjy0h5avb4b97mi3n0xvgm3-attica-5.49.0/lib/libKF5Attica.so.5.49.0 /nix/store/rgmxlirba45ji77rj90569nid54cfhh0-qtbase-5.11.1/lib/libQt5Network.so.5.11.1 /nix/store/fji2kvna7ki7z6zkv9yjzx07990mfn3q-kdbusaddons-5.49.0/lib/libKF5DBusAddons.so.5.49.0 /nix/store/rdqlcnl4mlpqrbw4vn20wivr5byd8pvi-knotifications-5.49.0/lib/libKF5Notifications.so.5.49.0 /nix/store/bnqjxlmddhkznv1ibx7dddzq7hh3b430-kconfig-5.49.0/lib/libKF5ConfigCore.so.5.49.0 /nix/store/5x3mq0fimdgri3cs939rwywjmjh7bcrb-kcoreaddons-5.49.0/lib/libKF5CoreAddons.so.5.49.0 /nix/store/q1qsdd87w6h44xl1kw4x0gbjby31bspd-kcodecs-5.49.0/lib/libKF5Codecs.so.5.49.0 /nix/store/9j4sj922labrd3njl6rr4lj2glmjpk53-phonon-qt5-4.10.1/lib/libphonon4qt5.so.4.10.1 /nix/store/rgmxlirba45ji77rj90569nid54cfhh0-qtbase-5.11.1/lib/libQt5Widgets.so.5.11.1 /nix/store/rgmxlirba45ji77rj90569nid54cfhh0-qtbase-5.11.1/lib/libQt5Gui.so.5.11.1 /nix/store/75079a8kn5lqskhv9gmplgzpn8j04p49-kactivities-5.49.0/lib/libKF5Activities.so.5.49.0 /nix/store/rgmxlirba45ji77rj90569nid54cfhh0-qtbase-5.11.1/lib/libQt5DBus.so.5.11.1 /nix/store/rgmxlirba45ji77rj90569nid54cfhh0-qtbase-5.11.1/lib/libQt5Core.so.5.11.1 -Wl,-rpath-link,/nix/store/qgjf14l6ajdakn4wp7qp69hzgazskaz2-lmdb-0.9.22/lib



Shouldn't the dolphin.dir link.txt also contain the private shared libraries of `libkdeinit5_dolphin.so` as otherwise there are missing symbols?
Comment 7 Bastian Köcher 2018-08-23 18:02:22 UTC
I managed to resolve the link error. After comparing your and mine `link.txt`, I saw that mine was missing the build `RPATH`. NixOS sets by default `CMAKE_SKIP_BUILD_RPATH=ON` and that needs to be set to `OFF`, to build it correctly. The RPATH is required that linker finds the private linked libraries, while linking `dolphin`.
Comment 8 Bastian Köcher 2018-08-23 18:03:39 UTC
Thanks for your help!