Project 'global_planner' tried to find library '-lpthread'. The library is
neither a target nor built/installed properly. Did you compile project
'costmap_2d'? Did you find_package() it before the subdirectory containing
its code is included?
cmake版本不对,用3.13,3.15的试了都不行,用3.12.4的可以。
https://blog.csdn.net/l1216766050/article/details/83719995
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915148
我想可能还有另外一种方法:
在costmap_2d或者正在编译的包的的cmakelists里添加target_link_libraries(${PROJECT_NAME} pthread)