Bug 334164 - building ktorrent from the repository fails: undefined reference to `bt::qHash(bt::SHA1Hash const&)'
Summary: building ktorrent from the repository fails: undefined reference to `bt::qHas...
Status: RESOLVED WORKSFORME
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: 4.3.1
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-01 06:40 UTC by George R. Goffe
Modified: 2018-11-01 13:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Build log for ktorrent et. al. (7.65 KB, application/x-gzip)
2014-06-11 05:28 UTC, George R. Goffe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description George R. Goffe 2014-05-01 06:40:25 UTC
I'm building ktorrent from the master on my Fedora 19 x86_64 system. Here's what git status says:

git status
On branch master
Your branch is up-to-date with 'origin/master'.

I'm seeing this error message:
[ 12%] Building CXX object libktcore/CMakeFiles/ktcore.dir/settings.o
Linking CXX shared library ../lib/libktcore.so
CMakeFiles/ktcore.dir/torrent/magnetmanager.o: In function `QHash<bt::SHA1Hash, QHashDummyValue>::findNode(bt::SHA1Hash const&, unsigned int*) const':
/usr/include/QtCore/qhash.h:882: undefined reference to `bt::qHash(bt::SHA1Hash const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libktcore.so.14.0.0] Error 1
make[1]: *** [libktcore/CMakeFiles/ktcore.dir/all] Error 2
make: *** [all] Error 2

Is this a bug or a George FU? Can you let me know what I'm doing wrong and what the correct method is please.

Thanks,

George...



Reproducible: Always

Steps to Reproduce:
1.attempt to build ktorrent 
2.
3.
Actual Results:  
[ 12%] Building CXX object libktcore/CMakeFiles/ktcore.dir/settings.o
Linking CXX shared library ../lib/libktcore.so
CMakeFiles/ktcore.dir/torrent/magnetmanager.o: In function `QHash<bt::SHA1Hash, QHashDummyValue>::findNode(bt::SHA1Hash const&, unsigned int*) const':
/usr/include/QtCore/qhash.h:882: undefined reference to `bt::qHash(bt::SHA1Hash const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libktcore.so.14.0.0] Error 1
make[1]: *** [libktcore/CMakeFiles/ktcore.dir/all] Error 2
make: *** [all] Error 2


Expected Results:  
Clean build.

I have a full build log available if needed.
Comment 1 Martin Nyhus 2014-06-07 12:24:44 UTC
Are you building with the Fedora version of libktorrent? You need the master branch since commit 286888b0 adds the missing function.
Comment 2 George R. Goffe 2014-06-08 01:18:36 UTC
Martin,

Thank you for your response.

I'm not so proficient with source control. How can I tell what branch I AM using? As I understand it, you have to build libktorrent first and then build ktorrent itself. I believe that I'm doing that. Here's the first part of my build log... where libktorrent is updated locally and then built. Can you tell from this snipit what version I'm building?

Thanks,

George...

#!/bin/bash -xv

 cd /tools/ktorrent
+ cd /tools/ktorrent

 cd  libktorrent
+ cd libktorrent
 git pull --verbose
+ git pull --verbose
remote: Counting objects: 19, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15 (delta 12), reused 0 (delta 0)
Unpacking objects: 100% (15/15), done.
From git://anongit.kde.org/libktorrent
   142ed57..caeb140  master     -> origin/master
 = [up to date]      1.0        -> origin/1.0
 = [up to date]      1.1        -> origin/1.1
 = [up to date]      1.2        -> origin/1.2
 = [up to date]      1.3        -> origin/1.3
Updating 142ed57..caeb140
Fast-forward
 src/torrent/timeestimator.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

 cd  ../ktorrent
+ cd ../ktorrent
 git pull --verbose
+ git pull --verbose
remote: Counting objects: 69, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 37 (delta 26), reused 0 (delta 0)
Unpacking objects: 100% (37/37), done.
From git://anongit.kde.org/ktorrent
   67be586..aeef621  master     -> origin/master
 = [up to date]      1.0        -> origin/1.0
 = [up to date]      1.1        -> origin/1.1
 = [up to date]      1.2        -> origin/1.2
 = [up to date]      2.0        -> origin/2.0
 = [up to date]      2.1        -> origin/2.1
 = [up to date]      3.0        -> origin/3.0
 = [up to date]      3.1        -> origin/3.1
 = [up to date]      3.2        -> origin/3.2
 = [up to date]      3.3        -> origin/3.3
 = [up to date]      4.0        -> origin/4.0
 = [up to date]      4.1        -> origin/4.1
 = [up to date]      4.2        -> origin/4.2
   2fda457..a6aa521  4.3        -> origin/4.3
Updating 67be586..aeef621
Fast-forward
 ktorrent/ktorrent.notifyrc                                | 2 ++
 plugins/downloadorder/ktdownloadorderplugin.desktop       | 4 ++--
 plugins/infowidget/ktinfowidgetplugin.desktop             | 4 ++--
 plugins/ipfilter/ktipfilterplugin.desktop                 | 2 +-
 plugins/logviewer/ktlogviewerplugin.desktop               | 2 +-
 plugins/mediaplayer/ktmediaplayerplugin.desktop           | 2 +-
 plugins/scripting/scripts/auto_remove/auto_remove.desktop | 2 +-
 plugins/shutdown/ktshutdownplugin.desktop                 | 2 +-
 plugins/stats/ktstatsplugin.desktop                       | 2 +-
 9 files changed, 12 insertions(+), 10 deletions(-)

 exit 0
+ exit 0

 mkdir  libktorrent/build 2>/dev/null
+ mkdir libktorrent/build
 cd  libktorrent/build
+ cd libktorrent/build
 cmake -DLIB_SUFFIX=64 -DCMAKE_MODULE_PATH=/usr/share/apps/cmake/modules/ -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) ..
kde4-config --prefix)
kde4-config --prefix
++ kde4-config --prefix
+ cmake -DLIB_SUFFIX=64 -DCMAKE_MODULE_PATH=/usr/share/apps/cmake/modules/ -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DCMAKE_INSTALL_PREFIX=/usr ..
-- Found Qt-Version 4.8.6 (using /bin/qmake-qt4)
-- Found X11: /usr/lib64/libX11.so
-- Adding /export/home/share/kde4/apps/cmake/modules to CMAKE_MODULE_PATH
-- Found KDE 4.11 include dir: /usr/include/kde4
-- Found KDE 4.11 library dir: /usr/lib64/kde4/devel
-- Found the KDE4 kconfig_compiler4 preprocessor: /usr/bin/kconfig_compiler4
-- Found automoc4: //bin/automoc4
-- Boost version: 1.53.0
-- Doxygen and dot found. make docs target is available
-- Configuring done
CMake Warning (dev) in src/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "ktorrent" has an INTERFACE_LINK_LIBRARIES property which differs
  from its LINK_INTERFACE_LIBRARIES properties.

  INTERFACE_LINK_LIBRARIES:

    KDE4__kio;/usr/lib64/libgmp.so;KDE4__solid;/usr/lib64/libgcrypt.so;/usr/lib64/libqca.so

  LINK_INTERFACE_LIBRARIES:

    KDE4__kdeui

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /tools/ktorrent/libktorrent/build
 make clean
+ make clean
 make depend
+ make depend
 make
+ make
Scanning dependencies of target ktorrent_automoc
Generating torrentinterface.moc
Generating encryptedauthenticate.moc
Generating peersourcemanager.moc
Generating waitjob.moc
Generating downloader.moc
Generating socks.moc
Comment 3 Martin Nyhus 2014-06-09 21:22:21 UTC
Based on the output from git pull it looks like you are building the master branch, so the question then is why the KTorrent build apparently finds the wrong version. Do you have the libktorrent-devel package installed (yum list libktorrent-devel)?

Also, could you try adding

    message(STATUS "LIBKTORRENT_FOUND=${LIBKTORRENT_FOUND}")
    message(STATUS "LIBKTORRENT_INCLUDE_DIR=${LIBKTORRENT_INCLUDE_DIR}")
    message(STATUS "LIBKTORRENT_LIBRARIES=${LIBKTORRENT_LIBRARIES}")

after

    find_package(KTorrent REQUIRED)

in the KTorrent CMakeLists.txt and post the build log (preferably including the commands) so we can check if CMake actually finds the version you built.
Comment 4 George R. Goffe 2014-06-11 05:28:26 UTC
Created attachment 87122 [details]
Build log for ktorrent et. al.

Martin,

Thank you for your help with this bug. 

Regards,

George...
Comment 5 Martin Nyhus 2014-06-17 21:36:04 UTC
The KTorrent build clearly finds the paths where libktorrent was installed so that shouldn't be the problem. I've tried various things on my end, but building against an older version of libktorrent (1.3 branch) gives me a template error related to the qHash function (as expected), but not the link error you're seeing. The only way I've been able to provoke the link error is by copying a version of magnetmanager.o that I built earlier into the build directory.

If you haven't already, try doing a clean build just in case, but if that doesn't work I'm not really sure what to try next...
Comment 6 George R. Goffe 2014-06-18 07:27:42 UTC
Martin,

By clean build, you mean check everything out again or do you mean make clean?

I'll guess that it's a new repo and redo the clone... and report.

Thanks,

George...
Comment 7 Martin Nyhus 2014-06-18 08:07:40 UTC
I'd delete the build directory so CMake starts from scratch as well
Comment 8 George R. Goffe 2014-06-19 09:12:17 UTC
Martin,

I actually saved the old directories just in case...

The build with a fresh clone worked wonderfully so I suppose you can close this bug report.

I'm wondering just why this problem appeared though. I have a script that does the update and build and it has make clean in it... Just how a reminant build product survived this make clean bothers me. Is the target wrong?

Do you want me to compare the directories?

Regards,

George...
Comment 9 Martin Nyhus 2014-06-23 12:09:45 UTC
make clean is correct, but it doesn't remove the CMake files so I guess the issue could have been there. I don't know where to start comparing the directories, so I suggest not spending more time on it unless it happens again.
Comment 10 George R. Goffe 2014-06-23 16:54:12 UTC
Martin,

I can compare the directories, file by file. I got burned some time with a new filesystem type... Copied everything from a large project that I had just completed... erased the old filesystem and then found that the new one was not readable. I was able to recover because I had backups but I got paranoid and developed a way of comparing directories of files in self defense.

I'll give it a try and report back if I find anything interesting.

Thanks for your help.

George...
Comment 11 Andrew Crouthamel 2018-10-31 04:08:25 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 12 George R. Goffe 2018-11-01 00:40:25 UTC
Let's close this one.

George...
Comment 13 Andrew Crouthamel 2018-11-01 13:23:45 UTC
Thanks for the update!