Linking Problems with pcl // Linkind order [closed]

asked 2013-08-14 00:32:04 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi there.
Fist my setup: Ros groovy on ubuntu, PCL-1.6 installed from ros repos.

I have a few modules that use PCL and a ros node that also uses PCL. I include the modules in my cmake list in the following way:

rosbuild_add_boost_directories
include_directories(${PROJECT_SOURCE_DIR}/../../../modules/xxx/include)
rosbuild_add_executable(scene_analyser src/scene_analyser.cpp)
rosbuild_link_boost(scene_analyser filesystem system)
target_link_libraries(scene_analyser ${PROJECT_SOURCE_DIR}/../../../modules/xxx/lib/libxxx.a)

in my manifest.xml i have the dependencies for pcl. When is now run make it runs into an error: undefined references for the pcl stuff that was used in my xxx module:

../../../../modules/xxx/lib/xxx.a(xxx.o): In function `xxx::cluster(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> >, double, int, int)':
xxx.cpp:(.text+0x19a7): undefined reference to `pcl::EuclideanClusterExtraction<pcl::PointXYZ>::extract(std::vector<pcl::PointIndices_<std::allocator<void> >, std::allocator<pcl::PointIndices_<std::allocator<void> > > >&)'

When i simply run make with VERBOSE=1 I can see, that pcl is in fact linked, but the order is messed up.

>>make VERBOSE=1

/usr/bin/c++ -O2 -g -pthread CMakeFiles/scene_analyser.dir/src/scene_analyser.cpp.o  -o ../bin/scene_analyser -rdynamic -L/opt/ros/groovy/lib -L/home/f/work/dfki/marion_szenenanalyse/ros_nodes/groovy/scene_analyser/../../../modules/scene_analyser/lib -lpcl_ros_tf -lpcl_ros_io -lpcl_ros_filters -l:/opt/ros/groovy/lib/libpcl_common.so -l:/opt/ros/groovy/lib/libpcl_kdtree.so -l:/opt/ros/groovy/lib/libpcl_octree.so -l:/opt/ros/groovy/lib/libpcl_search.so -l:/opt/ros/groovy/lib/libpcl_sample_consensus.so -l:/opt/ros/groovy/lib/libpcl_io.so -l:/opt/ros/groovy/lib/libpcl_features.so -l:/opt/ros/groovy/lib/libpcl_filters.so -l:/opt/ros/groovy/lib/libpcl_keypoints.so -l:/usr/lib/libqhull.so -l:/opt/ros/groovy/lib/libpcl_surface.so -l:/opt/ros/groovy/lib/libpcl_registration.so -l:/opt/ros/groovy/lib/libpcl_segmentation.so -l:/opt/ros/groovy/lib/libpcl_visualization.so -l:/opt/ros/groovy/lib/libpcl_tracking.so -ltf -lmessage_filters -lroscpp -lpthread -lcpp_common ../../../../modules/xxx/lib/xxx.a -lboost_filesystem-mt -lboost_system-mt -Wl,-rpath,/opt/ros/groovy/lib

The pcl stuff is linked before ../../../modules/xxx/lib/xxx.a, when i copy paste the complete command by hand, and inser the pcllibs at the end it all works fine.

Now, ultimatly my question: Is there a way to tell ros / cmake in what order it should link all the libraries? Or is my setup messed up?

edit retag flag offensive reopen merge delete

Closed for the following reason PCL Question: The PCL community prefers to answer questions at http://www.pcl-users.org/ by tfoote
close date 2015-03-09 17:10:40.769698