ros-perception / perception_open3d

Open3D analog to perception_pcl, containing conversion functions from Open3D to/from ROS types
Apache License 2.0
153 stars 29 forks source link

Undefined refrence to ros:: #16

Open chris-aeviator opened 3 years ago

chris-aeviator commented 3 years ago

When building the examples via catkin build. open3d_conversions builds fine. Running on ros-melodic "official" docker container

EDIT: same happens when running catkin_make

image image

Matnay commented 3 years ago

Hello @chris-aeviator. It seems the linking step fails and catkin doesn't link against the ROS libraries. I have been unable to replicate the error and it builds fine for me. The only difference seems to be the package name and as long as you have changed that in the package.xml and have not removed L17 <depend>roscpp</depend> that should not be a problem. Could you please let me know the compiler version you are using? Could you also try to build again after shifting your workspace from /opt to your home directory.

erik-fustes commented 3 years ago

Hi, I have the same error as @chris-aeviator. Screenshot from 2021-02-15 13-26-31 Screenshot from 2021-02-15 13-27-36

Ezzence commented 3 years ago

I had the same undefined references issue today as @TuVieja, @chris-aeviator, and managed to find a fix after some trial and error. When compiling Open3D from source, go into the top level CMakeLists file, and set GLIBCXX_USE_CXX11_ABI to ON instead of OFF.

I am running ubuntu 20, noetic, gcc 9.3, no docker just a standard setup, and this fixed the issue for me. This is probably more of a workaround then a solution, since the machine learning module of Open3D is not compiling yet for me with this setup, but at least this got the core of Open3D working with ROS, and this nice package as well for me. This might need to be looked into or at least noted down for the sake of future compilations @Matnay

Matnay commented 3 years ago

Hello @Ezzence, Thank you for providing a workaround. Sure, I did look into it but was unable to replicate the error, which in hindsight, was because I had compiled Open3D from source with the flags set to the following configuration: -DBUILD_UNIT_TESTS=ON -DBUILD_EIGEN3=ON -DBUILD_GLEW=ON -DBUILD_GLFW=ON -DBUILD_JSONCPP=ON -DBUILD_PNG=ON -DGLIBCXX_USE_CXX11_ABI=ON

Evidently, there existed issues (#414) on using ROS with Open3D that are resolved using your workaround. Although the update proposed above resolves the present issue, I will explore whether a better solution exists for the sake of future compilations.

tota1Noob commented 3 years ago

Same thing here, using c++ version of Open3D alongside PCL. CMAKE was reporting undefined reference to "pcl_visualizer.h" and some other headers.

The "Setting GLIBCXX_USE_CXX11_ABI to ON" workaround worked like a charm, saved my life quite literally. Looking forward to future updates.

incebellipipo commented 3 years ago

This worked for me as well:

cmake -DGLIBCXX_USE_CXX11_ABI=ON ..