Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CXX11 ABI incompatibility when using Open3D + ROS + PyTorch/Tensorflow together #3432

Closed
zhoupengwei opened this issue May 13, 2021 · 5 comments
Assignees
Labels
build/install Build or installation issue

Comments

@zhoupengwei
Copy link

zhoupengwei commented May 13, 2021

Do you have better suggestions to solve the link error with other libraries?eg. ros undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'


Describe the bug
Errors occur when Open3D library is linked together with ros.

To Reproduce
Steps to reproduce the behavior:
When I want to use the latest version to develop with the ROS system, I encountered a link error

  1. catkin build
  2. undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'

Expected behavior
The code should compile and work on major platforms including Windows, macOS and linux.

Environment (please complete the following information):

  • Operating system:
    Ubuntu 18.04
  • Python version:
    Python 3.8
  • Open3D version:
    0.12.0
  • Is this remote workstation?:
    no
  • How did you install Open3D?:
    build from source
  • Compiler version (if built from source):
    gcc 9.3

Additional context
I have successfully used open3d 0.10.0 and ROS to develop laser slam before. Now when I update to the latest version, I encounter some link errors related to the ROS system, such as undefined reference to ros::init(int&, char**, std::string const&, unsigned int). After we search the relevant errors, like 2286. This error can be corrected by setting cmake flag -DGLIBCXX_USE_CXX11_ABI=ON. Unfortunately, this will make it impossible to compile open3d_ML modules, because they do not use C + + 11ABI both TensorFlow and PyTorch, as shown in note. cmake -DGLIBCXX_USE_CXX11_ABI=ON -DBUILD_TENSORFLOW_OPS=ON will lead to errors simultaneously. Is there any better solution instead of set the cmake flag? I want to use the open3d_ML module at the same time.

@sanskar107 sanskar107 added the build/install Build or installation issue label May 13, 2021
@ssheorey
Copy link
Member

@benjaminum I see that libtorch has builds available both with and without the CXX11_ABI. Is libtorch sufficient for building Open3D instead of the full PyTorch? Something similar may be possible for Tensorflow, but I don't see a Tensorflow binary release with CXX11 ABI.

@ssheorey
Copy link
Member

@zpw6106 Is it possible to build ROS with -D_GLIBCXX_USE_CXX11_ABI=0 ?

@zhoupengwei
Copy link
Author

@ssheorey At present, it is impossible to do that, this leads to the link errors. I still haven't solved it.

@benjaminum
Copy link
Contributor

Sry for the late reply @zpw6106 . libtorch should be sufficient but will require changes to the cmake files. There could be problems using an op library linking to libtorch with a different ABI than the pytorch libs.
For tensorflow you could check if the tensorflow in the anaconda channel uses the ABI you need.

@ssheorey ssheorey changed the title Do you have better suggestions to solve the link error with other libraries?eg. ros undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)' CXX11 ABI incompatibility when using Open3D + ROS + PyTorch/Tensorflow together Aug 20, 2021
@ssheorey
Copy link
Member

@zpw6106 If you build either PyTorch or Tensorflow from source with the new CXX11_ABI, i.e. with _GLIBCXX_USE_CXX11_ABI=1 this combination of libraries will work, since Open3D now builds with _GLIBCXX_USE_CXX11_ABI=1 by default.

Closing this issue since it is up to PyTorch / TF to update their default build options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/install Build or installation issue
Projects
None yet
Development

No branches or pull requests

4 participants