How to add cvblob_DIR for find_package?
I'm trying to use Groovy, but i get blocked every time:
I want to use cvBlob with opencv in ROS. I installed both, my test program works in opencv. I think there shouldn't be any problem with the installation of this libs. My $LD_LIBRARY_PATH
points to /opt/ros/groovy/lib
, so i also copied there the libcvblob.so.
When I try to implement in groovy the same applicationo I get a nasty error after linking:
Linking CXX executable /home/elod/myWS/devel/lib/bagDetect/bagDetect
CMakeFiles/bagDetect.dir/src/main.cpp.o: In function `corridorProces(cv::Mat&)':
main.cpp:(.text+0x212): undefined reference to `cvLabel'
main.cpp:(.text+0x252): undefined reference to `cvRenderBlobs'
main.cpp:(.text+0x328): undefined reference to `cvLabel'
main.cpp:(.text+0x368): undefined reference to `cvRenderBlobs'
CMakeFiles/bagDetect.dir/src/main.cpp.o: In function `imageCallback(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)':
main.cpp:(.text+0xca2): undefined reference to `image_transport::Publisher::publish(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&) const'
CMakeFiles/bagDetect.dir/src/main.cpp.o: In function `main':
main.cpp:(.text+0x10c8): undefined reference to `image_transport::ImageTransport::ImageTransport(ros::NodeHandle const&)'
main.cpp:(.text+0x13ca): undefined reference to `image_transport::ImageTransport::advertise(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool)'
main.cpp:(.text+0x1525): undefined reference to `image_transport::ImageTransport::~ImageTransport()'
main.cpp:(.text+0x1794): undefined reference to `image_transport::ImageTransport::~ImageTransport()'
CMakeFiles/bagDetect.dir/src/main.cpp.o: In function `image_transport::ImageTransport::subscribe(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, void (*)(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&), image_transport::TransportHints const&)':
main.cpp:(.text._ZN15image_transport14ImageTransport9subscribeERKSsjPFvRKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEEERKNS_14TransportHintsE[image_transport::ImageTransport::subscribe(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, void (*)(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&), image_transport::TransportHints const&)]+0x5d): undefined reference to `image_transport::ImageTransport::subscribe(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, boost::function<void (boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)> const&, boost::shared_ptr<void> const&, image_transport::TransportHints const&)'
collect2: ld returned 1 exit status
make[2]: *** [/home/elod/myWS/devel/lib/bagDetect/bagDetect] Error 1
My package.xml:
<?xml version="1.0"?>
<package>
<name>bagDetect</name>
<version>0.0.0</version>
<description>The bagDetect package</description>
<maintainer email="elod@todo.todo">elod</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>cv_bridge</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>OpenCV</build_depend>
<run_depend>cv_bridge</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>OpenCV</run_depend>
</package>
My CMakeList.txt:
cmake_minimum_required(VERSION 2.8.3)
project(bagDetect)
find_package(catkin REQUIRED COMPONENTS cv_bridge roscpp rospy std_msgs)
catkin_package(
INCLUDE_DIRS include
# LIBRARIES bagDetect
CATKIN_DEPENDS cv_bridge roscpp
DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
include_directories(include
${catkin_INCLUDE_DIRS}
/home/elod/opencv/cmake/
)
add_executable(bagDetect src/main.cpp)
find_package(OpenCV REQUIRED)
target_link_libraries(bagDetect ${OpenCV_LIBS})
include($ENV{ROS_ROOT}/core/rosbuild/FindPkgConfig.cmake)
pkg_check_modules(CVBLOB REQUIRED cvBlob)
include_directories(${CVBLOB_INCLUDE_DIRS})
link_directories(${CVBLOB_LIBRARY_DIRS})
target_link_libraries(bagDetect ${CVBLOB_LIBRARIES})
target_link_libraries(bagDetect ${catkin_LIBRARIES ...