Dear community members,
Description of the problem:
I am writing and using a custom cpp extension using Pybind11 and Aten (python3 only). Everything was working well with pytorch<=0.4 (under Linux and MacOs with both gcc and clang). I use my own cmake routine to compile my extension.
Unfortunately, the last version of pytorch introduced a problem : the extension still compiles fine, but crash when I import the created module (which is in fact a shared object called libKeOpstorch6698ab2e06.cpython-36m-x86_64-linux-gnu.so
). Under python 3 it gives:
import libKeOpstorch6698ab2e06
[...]
ImportError: [...]/pykeops/build/libKeOpstorch6698ab2e06.cpython-36m-x86_64-linux-gnu.so:
undefined symbol: _ZN2at5ErrorC1ENS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
The error was reproduced on a debian testing (python3.6) and a Ubuntu16.04 LTS (python3.5).
Comments:
After de-mangling the missing symbol reads :
at::Error::Error(at::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
Looking for a solution I end up reading the he file [...]/lib/python3.5/site-packages/torch/lib/include/ATen/Error.h
. It has evolved a lot between 0.4 and 0.4.1. In the v0.4.1, this header contains a method at::Error::Error(SourceLocation source_location, std::string err)
which is close to the undefined symbol…
I suspect an unfortunate cast between std::string
and std::__cxx11::basic_string
(maybe by pybind11) … But I am currently stuck with this.
I will appreciate any idea/comment.
Best,
b.