oneTBB icon indicating copy to clipboard operation
oneTBB copied to clipboard

My Cmake can't find TBB::tbb and TBB::tbbmalloc

Open tanmayd26 opened this issue 2 years ago • 8 comments

`CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:14 (add_executable): Target "StateEstimator" links to target "TBB::tbb" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:14 (add_executable): Target "StateEstimator" links to target "TBB::tbbmalloc" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? `

I have it installed here: /usr/lib/x86_64-linux-gnu/libtbbmalloc_proxy.so /usr/lib/x86_64-linux-gnu/libtbbmalloc.so /usr/lib/x86_64-linux-gnu/libtbb.so.2 /usr/lib/x86_64-linux-gnu/libtbbmalloc.so.2 /usr/lib/x86_64-linux-gnu/libtbbmalloc_proxy.so.2 /usr/lib/x86_64-linux-gnu/libtbb.so

` libtbbmalloc_proxy.so.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libtbbmalloc_proxy.so.2 libtbbmalloc_proxy.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libtbbmalloc_proxy.so libtbbmalloc.so.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libtbbmalloc.so.2 libtbbmalloc.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libtbbmalloc.so libtbb.so.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/libtbb.so.2 libtbb.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libtbb.so

`

Can anyone help been struggling to get a working solution.

tanmayd26 avatar Dec 04 '23 21:12 tanmayd26

@tanmayd26 do you have reproducer steps? I am mostly interested in CMakelists.txt. Did you use find_package(TBB) as error message suggested?

isaevil avatar Dec 05 '23 07:12 isaevil

Yes here,

find_package(Eigen3 REQUIRED)
find_package(GeographicLib REQUIRED)
find_package (Boost REQUIRED COMPONENTS system filesystem thread chrono date_time atomic serialization regex timer)
include_directories(SYSTEM ${Boost_LIBRARY_DIRS})

include_directories(include ${catkin_INCLUDE_DIRS})
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})

find_package(GTSAM)
if(GTSAM_FOUND)
  find_package(TBB REQUIRED)
  include_directories(SYSTEM ${GTSAM_INCLUDE_DIR} "/usr/local/include" ${Boost_INCLUDE_DIRS}) 

  add_executable(StateEstimator StateEstimator.cpp)
message(==========${GeographicLib_LIBRARY_DIRS}/${GeographicLib_LIBRARIES})
  target_link_libraries(StateEstimator ${catkin_LIBRARIES} ${ROS_LIBRARIES} gtsam ${GeographicLib_LIBRARY_DIRS}/libGeographic.so ${TBB_LIBRARIES} ar_diagnostics ${Boost_LIBRARIES})
  add_dependencies(StateEstimator autorally_msgs_gencpp)

  install(TARGETS StateEstimator
          ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
          LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
          RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
endif()

tanmayd26 avatar Dec 05 '23 20:12 tanmayd26

I got some extra analysis done. I added a message to print the location and yes it knows that tbb is here in this location.

-- TBB_LIBRARIES: /usr/lib/x86_64-linux-gnu/libtbb.so;/usr/lib/x86_64-linux-gnu/libtbbmalloc.so;/usr/lib/x86_64-linux-gnu/libtbb.so;/usr/lib/x86_64-linux-gnu/libtbbmalloc.so
==========/usr/local/lib/GeographicLib
CMake Warning at autorally/autorally_core/src/CameraAutoBalance/CMakeLists.txt:23 (message):
  Could not find FlyCapture library.  Will not build CameraAutoBalance for
  Point Grey cameras


CMake Warning at autorally/autorally_core/src/CameraAutoBalance/CMakeLists.txt:44 (message):
  Could not find Spinnaker library.  Will not build CameraAutoBalance for
  FLIR cameras


-- +++ processing catkin package: 'autorally_control'
-- ==> add_subdirectory(autorally/autorally_control)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.55.0")  
-- Installing devel-space wrapper /home/tanmay/catkin_ws/src/autorally/autorally_control/src/gpsWaypoint/GenerateWaypoints to /home/tanmay/catkin_ws/devel/lib/autorally_control
-- Found CUDA: /usr (found version "10.1") 
-- The CUDA compiler identification is NVIDIA 10.1.243
-- Check for working CUDA compiler: /usr/bin/nvcc
-- Check for working CUDA compiler: /usr/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Configuring done
CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:17 (add_executable):
  Target "StateEstimator" links to target "TBB::tbb" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:17 (add_executable):
  Target "StateEstimator" links to target "TBB::tbbmalloc" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

tanmayd26 avatar Dec 05 '23 21:12 tanmayd26

@tanmayd26 that is interesting. Could you please provide more details of your environment: TBB package used for installation and OS? It seems like you are using TBB 2020 based on the name of libtbb.so.2, am I right? Could you also attach clean cmake --debug-find <your project folder> output?

isaevil avatar Dec 06 '23 09:12 isaevil

CMake Error: The source directory "/home/tanmay/--debug-find" does not exist. Specify --help for usage, or press the help button on the CMake GUI.

I ran this: cmake --debug-find catkin_ws/src/autorally/

tanmayd26 avatar Dec 06 '23 15:12 tanmayd26

@tanmayd26 you can use CMAKE_FIND_DEBUG_MODE instead (https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_DEBUG_MODE.html).

isaevil avatar Dec 06 '23 16:12 isaevil

(my_ros_env) tanmay@tanmay-lab-ubuntu:~/catkin_ws/build$ cmake --debug-find /home/tanmay/catkin_ws/src
-- Using CATKIN_DEVEL_PREFIX: /home/tanmay/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/tanmay/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.10") 
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 13 packages in topological order:
-- ~~  - autorally (metapackage)
-- ~~  - autorally_description
-- ~~  - autorally_gazebo
-- ~~  - pointgrey_camera_description
-- ~~  - statistics_msgs
-- ~~  - image_exposure_msgs
-- ~~  - autorally_msgs
-- ~~  - autorally_util
-- ~~  - imu_3dm_gx4
-- ~~  - wfov_camera_msgs
-- ~~  - pointgrey_camera_driver
-- ~~  - autorally_core
-- ~~  - autorally_control
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin metapackage: 'autorally'
-- ==> add_subdirectory(autorally/autorally)
-- +++ processing catkin package: 'autorally_description'
-- ==> add_subdirectory(autorally/autorally_description)
-- +++ processing catkin package: 'autorally_gazebo'
-- ==> add_subdirectory(autorally/autorally_gazebo)
-- +++ processing catkin package: 'pointgrey_camera_description'
-- ==> add_subdirectory(pointgrey_camera_driver/pointgrey_camera_description)
-- +++ processing catkin package: 'statistics_msgs'
-- ==> add_subdirectory(pointgrey_camera_driver/statistics_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- statistics_msgs: 1 messages, 0 services
-- +++ processing catkin package: 'image_exposure_msgs'
-- ==> add_subdirectory(pointgrey_camera_driver/image_exposure_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- image_exposure_msgs: 3 messages, 0 services
-- +++ processing catkin package: 'autorally_msgs'
-- ==> add_subdirectory(autorally/autorally_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: thread 
-- autorally_msgs: 15 messages, 0 services
-- +++ processing catkin package: 'autorally_util'
-- ==> add_subdirectory(autorally/autorally_util)
-- +++ processing catkin package: 'imu_3dm_gx4'
-- ==> add_subdirectory(imu_3dm_gx4)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- imu_3dm_gx4: 1 messages, 0 services
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0")  
-- +++ processing catkin package: 'wfov_camera_msgs'
-- ==> add_subdirectory(pointgrey_camera_driver/wfov_camera_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- wfov_camera_msgs: 3 messages, 0 services
-- +++ processing catkin package: 'pointgrey_camera_driver'
-- ==> add_subdirectory(pointgrey_camera_driver/pointgrey_camera_driver)
-- libflycapture found in system library path
-- libflycapture library: /usr/lib/libflycapture.so.2
-- libflycapture copied from: /usr/lib/libflycapture.so.2.13.3.31 into /home/tanmay/catkin_ws/devel/lib/libflycapture.so.2
-- +++ processing catkin package: 'autorally_core'
-- ==> add_subdirectory(autorally/autorally_core)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Reading /usr/local/lib/cmake/GeographicLib/geographiclib-config.cmake
-- GeographicLib configuration, version 1.49
--   ${GeographicLib_LIBRARIES} set to shared library
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: chrono date_time filesystem regex serialization system thread timer 
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.65") found components: serialization system filesystem thread program_options date_time timer chrono regex 
-- Found Intel TBB
-- GTSAM include directory:  /usr/local/lib/cmake/GTSAM/../../../include
-- Found Intel TBB
==========/usr/local/lib/GeographicLib
CMake Warning at autorally/autorally_core/src/CameraAutoBalance/CMakeLists.txt:44 (message):
  Could not find Spinnaker library.  Will not build CameraAutoBalance for
  FLIR cameras


-- +++ processing catkin package: 'autorally_control'
-- ==> add_subdirectory(autorally/autorally_control)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.55.0")  
-- Installing devel-space wrapper /home/tanmay/catkin_ws/src/autorally/autorally_control/src/gpsWaypoint/GenerateWaypoints to /home/tanmay/catkin_ws/devel/lib/autorally_control
-- Configuring done
CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:24 (add_executable):
  Target "StateEstimator" links to target "TBB::tbb" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:24 (add_executable):
  Target "StateEstimator" links to target "TBB::tbbmalloc" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Warning at autorally/autorally_core/src/CameraAutoBalance/CMakeLists.txt:12 (add_library):
  Cannot generate a safe runtime search path for target
  CameraAutoBalancePtGrey because files in some directories may conflict with
  libraries in implicit directories:

    runtime library [libflycapture.so.2] in /usr/lib may be hidden by files in:
      /home/tanmay/catkin_ws/devel/lib

  Some of these libraries may not be found correctly.


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

tanmayd26 avatar Dec 07 '23 17:12 tanmayd26

@tanmayd26 it is hard to tell what went wrong. It seems to me that this is an environment issue. Could you provide more details on your environment (TBB package used, OS, etc)?

And could you please rerun your cmake --debug-find command on cleaned build directory because this log you've sent doesn't include search steps of TBB package.

isaevil avatar Dec 08 '23 08:12 isaevil

@tanmayd26 is this issue still relevant?

nofuturre avatar Jul 12 '24 14:07 nofuturre

No I will close it.

tanmayd26 avatar Jul 17 '24 16:07 tanmayd26