cmake compile error: pthread not found, how to tell the compiler to look for pthread lib?

asked 2018-12-29 15:15:16 -0500

ros_answer gravatar image

Hi all, I run into a compile error while installing Melodic on Debian9-- Stretch.

Basically, I followed the instructions here on a freshly installed Debian9 and had the following error when I was executing this cmd ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release:

CMake Error at /home/parallels/ros_catkin_ws/devel_isolated/class_loader/share/class_loader/cmake/class_loaderConfig.cmake:148 (message):
Project 'class_loader' tried to find library '-lpthread'.  The library is
neither a target nor built/installed properly.  Did you compile project
'class_loader'? Did you find_package() it before the subdirectory
containing its code is included?
Call Stack (most recent call first):
/home/parallels/ros_catkin_ws/install_isolated/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
test/CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/parallels/ros_catkin_ws/build_isolated/class_loader/CMakeFiles/CMakeOutput.log".
See also "/home/parallels/ros_catkin_ws/build_isolated/class_loader/CMakeFiles/CMakeError.log".
<== Failed to process package 'class_loader': 
Command '['/home/parallels/ros_catkin_ws/install_isolated/env.sh', 'cmake',         '/home/parallels/ros_catkin_ws/src/class_loader', '-DCATKIN_DEVEL_PREFIX=/home/parallels/ros_catkin_ws/devel_isolated/class_loader', '-DCMAKE_INSTALL_PREFIX=/home/parallels/ros_catkin_ws/install_isolated', '-DCMAKE_BUILD_TYPE=debug', '-G', 'Unix Makefiles']' returned non-zero exit status 1

Reproduce this error by running:
==> cd /home/parallels/ros_catkin_ws/build_isolated/class_loader &&    /home/parallels/ros_catkin_ws/install_isolated/env.sh cmake /home/parallels/ros_catkin_ws/src/class_loader -DCATKIN_DEVEL_PREFIX=/home/parallels/ros_catkin_ws/devel_isolated/class_loader -    DCMAKE_INSTALL_PREFIX=/home/parallels/ros_catkin_ws/install_isolated -DCMAKE_BUILD_TYPE=debug -G 'Unix Makefiles'

A similar error was found here, but there's no effective solution to that problem.

edit retag flag offensive close merge delete

Comments

What CMake version do you have? I ran into this with Gentoo not that long ago. https://github.com/ros/ros-overlay/is...

allenh1 gravatar image allenh1  ( 2018-12-31 08:46:09 -0500 )edit

Mine is cmake 3.13.2. Will updating the cmake make a difference? Or there's a compatible version to compile it?

ros_answer gravatar image ros_answer  ( 2018-12-31 09:27:01 -0500 )edit
1

Try cmake < 3.13. That seemed to fix my issues on Gentoo. Still working on a patch for this.

allenh1 gravatar image allenh1  ( 2018-12-31 09:34:23 -0500 )edit

Thanks for the suggestion. I'll give it a try!

ros_answer gravatar image ros_answer  ( 2018-12-31 10:49:16 -0500 )edit

I might have used the cmake 3.7.2 as when i used `apt-cache madsion cmake', it came out 3.7.2. But when I run cmake --version, it gave me 3.12.2.

ros_answer gravatar image ros_answer  ( 2019-01-03 11:53:38 -0500 )edit