0
$\begingroup$

Rosanswers logo

There seems to be an issue with compiling ROS nodes that use pcl on Ubuntu 11.10. When I try to compile my node on 10.04 I don't have any problems. Both installations were installed from the debian packages ros-electric-desktop-full and ros-electric-perception-pcl-addons.

  1. Ubuntu 10.04, 32-bit, ROS Electric: Works
  2. Ubuntu 11.10, 32-bit, ROS Electric: Doesn't compile

My node is pretty simple, mainly just visualizing a static point cloud that I create.

In the second case, I get the following compiler error during linking.

...
Linking CXX executable ../bin/publish_primitives
/usr/bin/ld: CMakeFiles/publish_primitives.dir/src/publish_primitives.o: undefined reference to symbol 'vtkSmartPointerBase::operator=(vtkObjectBase*)'
/usr/bin/ld: note: 'vtkSmartPointerBase::operator=(vtkObjectBase*)' is defined in DSO /usr/lib/libvtkCommon.so.5.6 so try adding it to the linker command line
/usr/lib/libvtkCommon.so.5.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
...

I manually added the required libraries in CMakeLists.txt (below) and it fixes the compiler problem.

rosbuild_add_executable(publish_primitives src/publish_primitives.cpp)
target_link_libraries(publish_primitives libvtkCommon.so libvtkFiltering.so )

Messing with the compiler flags for pcl is beyond me, so I'll leave it to the higher ups to figure out what is going on.


Originally posted by Kyle Strabala on ROS Answers with karma: 186 on 2012-01-30

Post score: 3

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

It looks like there was a change in linker behavior. thread with links

Fedora documentation of the change


Originally posted by tfoote with karma: 58457 on 2012-06-09

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$
0
$\begingroup$

Rosanswers logo

After upgrading either ROS or Ubuntu from an earlier distribution, you should clean your working trees and rebuild them. Three different ways to do that:

  • rosmake --pre-clean
  • make clean in every package
  • check out new copies and build everything from scratch

Originally posted by joq with karma: 25443 on 2012-01-31

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Kyle Strabala on 2012-02-07:
I meant that I am using a fresh install of everything (Ubuntu 11.10, ROS Electric from deb packages). I have tried cleaning and re-building without success.

Comment by joq on 2012-02-01:
What does that mean? Can't you rebuild your working copies?

Comment by Kyle Strabala on 2012-02-01:
Unfortunately, my 11.10 system was built from scratch. Also, I had three other 11.10 users try it on their systems with the same results.

$\endgroup$
0
$\begingroup$

Rosanswers logo

I don't know if this can help you but I had almost the identical problem and I solved adding ${PCL_LIBRARIES} in target_link_libraries, like

target_link_libraries(publish_primitives ${PCL_LIBRARIES} libvtkCommon.so libvtkFiltering.so )

Originally posted by Saphrosit with karma: 197 on 2012-06-22

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Neil Traft on 2014-07-31:
The PCL_LIBRARIES link should not be necessary if you are in ROS and you correctly specified the dependencies in your package manifest (as described in the ROS PCL tutorials: http://wiki.ros.org/pcl/Tutorials ).

Comment by Neil Traft on 2014-07-31:
Furthermore, if you want to include all VTK libraries, you can use find_package(VTK REQUIRED) and target_link_libraries(example ${VTK_LIBRARIES}).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.