困扰多时的torch-sparse编译错误得到解决

最近在编译torch-geometric库的时候,经常遇到这个错误:

/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char32_t; _Traits = std::char_traits; _Alloc = std::allocator]’ without object

  error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

  ----------------------------------------

  ERROR: Failed building wheel for torch-sparse

几经搜索和实验,编译错误得到解决如下:

You can refer to this link and it solves my question: https://forums.developer.nvidia.com/t/cuda-10-1-nvidia-youre-now-fixing-gcc-bugs-that-gcc-doesnt-even-have/71063/6

changing devtoolset-8/root/usr/include/c++/8/bits/basic_string.tcc:1067 from this:

__p->_M_set_sharable();

to this seems to fix the compiler error:

(*__p)._M_set_sharable()。

记录一下,以免以后忘记!

你可能感兴趣的:(困扰多时的torch-sparse编译错误得到解决)