Skip to content

[joss-review] Building in debug mode causes linker errors for tbb #69

@nilsfriess

Description

@nilsfriess

To reproduce:

mkdir build
cd build
cmake .. -DHTOOL_WITH_EXAMPLES=True -DCMAKE_BUILD_TYPE=Debug
make Use_hmatrix

When I don't specify -DCMAKE_BUILD_TYPE=Debug or explicitly use -DCMAKE_BUILD_TYPE=Release, everything works. In debug mode, the linker complains that it cannot find some tbb::detail::bla bla functions.

This fixes it:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 63d568d..042388c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,7 +109,7 @@ find_package(HPDDM)
 #=== HTOOL as header only library
 add_library(htool INTERFACE)
 target_include_directories(htool INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> ${HPDDM_INCLUDE_DIRS} ${MKL_INC_DIR})
-target_link_libraries(htool INTERFACE MPI::MPI_CXX BLAS::BLAS LAPACK::LAPACK)
+target_link_libraries(htool INTERFACE MPI::MPI_CXX BLAS::BLAS LAPACK::LAPACK tbb)
 if(OpenMP_CXX_FOUND)
     target_link_libraries(htool INTERFACE OpenMP::OpenMP_CXX)
 endif()

but I have no idea why this is not necessary in Release mode.

cc: openjournals/joss-reviews#9279

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions