https://bugs.kde.org/show_bug.cgi?id=473628

            Bug ID: 473628
           Summary: Heaptrack fails to compile because of missing
                    dependency to pthread
    Classification: Applications
           Product: Heaptrack
           Version: unspecified
          Platform: RedHat Enterprise Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: m...@milianw.de
          Reporter: fusca...@gmail.com
  Target Milestone: ---

I got a compile failure on RHEL8 (Rocky linux 8.8).

```
heaptrack_build 0 > ninja
[57/96] Linking CXX executable bin/tst_trace
FAILED: bin/tst_trace 
: && /usr/bin/c++ -Wall -Wextra -Wpedantic -g 
tests/auto/CMakeFiles/tst_trace.dir/tst_trace.cpp.o -o bin/tst_trace 
src/track/libheaptrack_unwind.a  /usr/lib64/libunwind.so && :
tests/auto/CMakeFiles/tst_trace.dir/tst_trace.cpp.o: In function
`std::thread::thread<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<DOCTEST_ANON_FUNC_20()::{lambda()#1}>
>,
void>::_Async_state_impl(std::tuple<DOCTEST_ANON_FUNC_20()::{lambda()#1}>&&)::{lambda()#1},
,
void>(std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<DOCTEST_ANON_FUNC_20()::{lambda()#1}>
>,
void>::_Async_state_impl(std::tuple<DOCTEST_ANON_FUNC_20()::{lambda()#1}>&&)::{lambda()#1}&&)':
/usr/include/c++/8/thread:127: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
[61/96] Building CXX object
src/analyze/print/CMakeFiles/heaptrack_print.dir/heaptrack_print.cpp.o
ninja: build stopped: subcommand failed.
```

This is the patch I'm using to fix the problem:
```
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index 57af007..efdaa05 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -30,7 +30,7 @@ endif()

 add_executable(tst_trace tst_trace.cpp)
 set_target_properties(tst_trace PROPERTIES RUNTIME_OUTPUT_DIRECTORY
"${PROJECT_BINARY_DIR}/${BIN_INSTALL_DIR}")
-target_link_libraries(tst_trace heaptrack_unwind)
+target_link_libraries(tst_trace heaptrack_unwind pthread)
 target_compile_definitions(tst_trace PRIVATE -DCATCH_CONFIG_MAIN)
 add_test(NAME tst_trace COMMAND tst_trace)
 ```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to