SUMMARY heaptrack fails to build on Ubuntu-18.04.3 STEPS TO REPRODUCE 1. git clone https://github.com/KDE/heaptrack.git 2. cd heaptrack 3. mkdir build 4. cd build 5. cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. 6. make 7. observe the following build error: [ 30%] Built target heaptrack_gui_private_autogen [ 31%] Building CXX object src/analyze/gui/CMakeFiles/heaptrack_gui_private.dir/parser.cpp.o /home/dope/sb/heaptrack/src/analyze/gui/parser.cpp: In member function \u2018std::size_t CacheSymbolHash::operator()(const Symbol&) const\u2019: /home/dope/sb/heaptrack/src/analyze/gui/parser.cpp:41:54: error: use of deleted function \u2018std::hash<QString>::hash()\u2019 boost::hash_combine(seed, std::hash<QString>{}(symbol.symbol)); ^ In file included from /usr/include/c++/7/bits/basic_string.h:6587:0, from /usr/include/c++/7/string:52, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:52, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:49, from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1, from /home/dope/sb/heaptrack/src/analyze/gui/parser.h:22, from /home/dope/sb/heaptrack/src/analyze/gui/parser.cpp:19: /usr/include/c++/7/bits/functional_hash.h:101:12: note: \u2018std::hash<QString>::hash()\u2019 is implicitly deleted because the default definition would be ill-formed: struct hash : __hash_enum<_Tp> ^~~~ /usr/include/c++/7/bits/functional_hash.h:101:12: error: no matching function for call to \u2018std::__hash_enum<QString, false>::__hash_enum()\u2019 /usr/include/c++/7/bits/functional_hash.h:82:7: note: candidate: std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = QString; bool <anonymous> = false] __hash_enum(__hash_enum&&); ^~~~~~~~~~~ /usr/include/c++/7/bits/functional_hash.h:82:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/7/bits/functional_hash.h:101:12: error: \u2018std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = QString; bool <anonymous> = false]\u2019 is private within this context struct hash : __hash_enum<_Tp> ^~~~ /usr/include/c++/7/bits/functional_hash.h:83:7: note: declared private here ~__hash_enum(); ^ /home/dope/sb/heaptrack/src/analyze/gui/parser.cpp:42:54: error: use of deleted function \u2018std::hash<QString>::hash()\u2019 boost::hash_combine(seed, std::hash<QString>{}(symbol.binary)); ^ /home/dope/sb/heaptrack/src/analyze/gui/parser.cpp:43:54: error: use of deleted function \u2018std::hash<QString>::hash()\u2019 boost::hash_combine(seed, std::hash<QString>{}(symbol.path)); ^ src/analyze/gui/CMakeFiles/heaptrack_gui_private.dir/build.make:88: recipe for target 'src/analyze/gui/CMakeFiles/heaptrack_gui_private.dir/parser.cpp.o' failed make[2]: *** [src/analyze/gui/CMakeFiles/heaptrack_gui_private.dir/parser.cpp.o] Error 1 CMakeFiles/Makefile2:603: recipe for target 'src/analyze/gui/CMakeFiles/heaptrack_gui_private.dir/all' failed make[1]: *** [src/analyze/gui/CMakeFiles/heaptrack_gui_private.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 OBSERVED RESULT Build failure EXPECTED RESULT It should build successfully SOFTWARE/OS VERSIONS $ cmake -DCMAKE_BUILD_TYPE=Release .. -- The C compiler identification is GNU 7.4.0 -- The CXX compiler identification is GNU 7.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Boost version: 1.65.1 -- Found the following Boost libraries: -- system -- filesystem -- iostreams -- regex -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Found ZLIB: /pkg/lib/libz.so (found version "1.2.11") -- Found ZSTD: /usr/lib/x86_64-linux-gnu/libzstd.so -- Performing Test HAVE_CXX11_SUPPORT -- Performing Test HAVE_CXX11_SUPPORT - Success -- Looking for cfree -- Looking for cfree - not found -- Performing Test LIBUNWIND_HAS_UNW_GETCONTEXT -- Performing Test LIBUNWIND_HAS_UNW_GETCONTEXT - Success -- Performing Test LIBUNWIND_HAS_UNW_INIT_LOCAL -- Performing Test LIBUNWIND_HAS_UNW_INIT_LOCAL - Success -- Performing Test LIBUNWIND_HAS_UNW_BACKTRACE -- Performing Test LIBUNWIND_HAS_UNW_BACKTRACE - Success -- Performing Test LIBUNWIND_HAS_UNW_BACKTRACE_SKIP -- Performing Test LIBUNWIND_HAS_UNW_BACKTRACE_SKIP - Failed -- Performing Test LIBUNWIND_HAS_UNW_SET_CACHE_SIZE -- Performing Test LIBUNWIND_HAS_UNW_SET_CACHE_SIZE - Failed -- Found LibUnwind: /usr/include/x86_64-linux-gnu (found version "1.2.1") -- Performing Test HAVE_LINUX_HEADERS -- Performing Test HAVE_LINUX_HEADERS - Success -- Performing Test FLAG_UNWIND_TABLES -- Performing Test FLAG_UNWIND_TABLES - Success -- Performing Test HAVE_SYNC_FUNCTIONS -- Performing Test HAVE_SYNC_FUNCTIONS - Success -- Performing Test HAVE_ATOMIC_FUNCTIONS -- Performing Test HAVE_ATOMIC_FUNCTIONS - Success -- Looking for mmap -- Looking for mmap - found -- Looking for lstat -- Looking for lstat - found -- Looking for readlink -- Looking for readlink - found -- Looking for MAP_ANONYMOUS -- Looking for MAP_ANONYMOUS - found -- Looking for MAP_ANON -- Looking for MAP_ANON - found -- Looking for dl_iterate_phdr -- Looking for dl_iterate_phdr - found -- Looking for fcntl -- Looking for fcntl - found -- Looking for strnlen -- Looking for strnlen - found -- Looking for getexecname -- Looking for getexecname - not found -- Boost version: 1.65.1 -- Found the following Boost libraries: -- iostreams -- program_options -- regex -- Found KF5CoreAddons: /usr/lib/x86_64-linux-gnu/cmake/KF5CoreAddons/KF5CoreAddonsConfig.cmake (found version "5.44.0") -- Found Gettext: /usr/bin/msgmerge (found version "0.19.8.1") -- Found PythonInterp: /usr/bin/python (found version "2.7.15") -- Found KF5I18n: /usr/lib/x86_64-linux-gnu/cmake/KF5I18n/KF5I18nConfig.cmake (found version "5.44.0") -- Found KF5ItemModels: /usr/lib/x86_64-linux-gnu/cmake/KF5ItemModels/KF5ItemModelsConfig.cmake (found version "5.44.0") -- Found KF5ThreadWeaver: /usr/lib/x86_64-linux-gnu/cmake/KF5ThreadWeaver/KF5ThreadWeaverConfig.cmake (found version "5.44.0") -- Found KF5ConfigWidgets: /usr/lib/x86_64-linux-gnu/cmake/KF5ConfigWidgets/KF5ConfigWidgetsConfig.cmake (found version "5.44.0") -- Found KF5KIO: /usr/lib/x86_64-linux-gnu/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.44.0") -- Found KF5: success (found version "5.44.0") found components: CoreAddons I18n ItemModels ThreadWeaver ConfigWidgets KIO -- Looking for __GLIBC__ -- Looking for __GLIBC__ - found -- Performing Test _OFFT_IS_64BIT -- Performing Test _OFFT_IS_64BIT - Success -- Performing Test HAVE_DATE_TIME -- Performing Test HAVE_DATE_TIME - Success -- Performing Test HAVE_MALLOC_H -- Performing Test HAVE_MALLOC_H - Success -- The following OPTIONAL packages have been found: * Qt5Gui (required version >= 5.9.5) * Qt5Widgets * ECM (required version >= 1.0.0) * KF5CoreAddons * KF5I18n * KF5ItemModels * KF5ThreadWeaver * KF5ConfigWidgets * KF5KIO * KF5 * Qt5Core (required version >= 5.9.5) * Qt5Test * Qt5 (required version >= 5.2.0) -- The following RECOMMENDED packages have been found: * Zstd Zstandard offers better (de)compression performance compared with gzip/zlib, making heaptrack faster and datafiles smaller. * KChart (required version >= 2.6.0) Required for the heaptrack_gui executable. Get it from the kdiagram module. -- The following REQUIRED packages have been found: * Threads * ZLIB * Libunwind * Boost (required version >= 1.41.0) * Gettext * PythonInterp -- Configuring done -- Generating done -- Build files have been written to: /home/dope/sb/heaptrack/build ADDITIONAL INFORMATION I was using this heaptrack git SHA1: ``` commit 8df827a2818187e18b26ec3c46d2143301148aec Author: David Faure <faure@kde.org> Date: Thu Oct 3 19:37:16 2019 +0200 ```
I fixed (or worked around) the compilation error using: diff --git a/src/analyze/gui/parser.cpp b/src/analyze/gui/parser.cpp index 3197a5e..fbdec81 100644 --- a/src/analyze/gui/parser.cpp +++ b/src/analyze/gui/parser.cpp @@ -37,11 +37,10 @@ struct CacheSymbolHash { std::size_t operator()(const Symbol &symbol) const noexcept { - size_t seed = 0; - boost::hash_combine(seed, std::hash<QString>{}(symbol.symbol)); - boost::hash_combine(seed, std::hash<QString>{}(symbol.binary)); - boost::hash_combine(seed, std::hash<QString>{}(symbol.path)); - return seed; + std::size_t h1 = qHash(symbol.symbol); + std::size_t h2 = qHash(symbol.binary); + std::size_t h3 = qHash(symbol.path); + return h1 ^ (h2 << 1) ^ (h3 << 2); } }; Hopefully that's still a good hash. But then I still get another build error: [ 37%] Linking CXX executable ../../../bin/heaptrack_gui /pkg/lib/libpng16.so.16: undefined reference to `inflateReset2@ZLIB_1.2.3.4' /pkg/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9' collect2: error: ld returned 1 exit status src/analyze/gui/CMakeFiles/heaptrack_gui.dir/build.make:306: recipe for target 'bin/heaptrack_gui' failed make[2]: *** [bin/heaptrack_gui] Error 1 CMakeFiles/Makefile2:643: recipe for target 'src/analyze/gui/CMakeFiles/heaptrack_gui.dir/all' failed make[1]: *** [src/analyze/gui/CMakeFiles/heaptrack_gui.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2
The link error in my previous comment was a problem on my side. I finally built successfully after removing a /pkg/bin/ directory from my path. But consider the patch in my previous comment to fix the compilation with the hash function.
the build error should be fixed now, please double check and reopen otherwise thanks for the report!