Ask Your Question
3

Problems compiling nodes using pcl in Ubuntu 11.10

asked 2012-01-30 14:54:01 -0500

Kyle Strabala gravatar image

updated 2014-01-28 17:11:13 -0500

ngrennan gravatar image

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.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2012-06-09 11:20:41 -0500

tfoote gravatar image

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

Fedora documentation of the change

edit flag offensive delete link more
1

answered 2012-01-31 02:30:40 -0500

joq gravatar image

updated 2012-01-31 02:31:16 -0500

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
edit flag offensive delete link more

Comments

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.
Kyle Strabala gravatar image Kyle Strabala  ( 2012-02-01 00:28:15 -0500 )edit
What does that mean? Can't you rebuild your working copies?
joq gravatar image joq  ( 2012-02-01 02:13:57 -0500 )edit
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.
Kyle Strabala gravatar image Kyle Strabala  ( 2012-02-07 12:36:45 -0500 )edit
1

answered 2012-06-22 10:39:50 -0500

Saphrosit gravatar image

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 )
edit flag offensive delete link more

Comments

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 ).

Neil Traft gravatar image Neil Traft  ( 2014-07-31 19:25:10 -0500 )edit

Furthermore, if you want to include all VTK libraries, you can use `find_package(VTK REQUIRED)` and `target_link_libraries(example ${VTK_LIBRARIES})`.

Neil Traft gravatar image Neil Traft  ( 2014-07-31 19:26:40 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-01-30 14:54:01 -0500

Seen: 2,024 times

Last updated: Jun 22 '12