困扰多时的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<char32_t>; _Alloc = std::allocator<char32_t>]’ 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()。

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

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容