在进行一些python三方库编译的时候,有时候会因为环境中的GCC版本导致编译错误,比如在mmdet3d,mmcv-full等库的使用中。
Your compiler (g++ 4.8.5) may be ABI-incompatible with PyTorch!
Please use a compiler that is ABI-compatible with GCC 5.0 and above.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
for instructions on how to install GCC 5 or higher.
比如这个case中,说我的g++版本是4.8.5,需要把GCC提高到5.0以上
下面代码一通操作
sudo yum install redis
export ENABLED_YUM_REPOS=cuda,base,extras,centosplus,updates,epel,epel-debuginfo,epel-source,sankuai,data-centos-sclo
sudo yum --disablerepo=* --enablerepo=$ENABLED_YUM_REPOS install -y devtoolset-6-gcc devtoolset-6-gcc-c++ devtoolset-6-binutils
unset LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/rh/devtoolset-6/root:/opt/rh/devtoolset-6/root/dyninst/dyninst:/lib64:/home/sankuai/conda/envs/codelab/lib:/usr/local/cuda/lib:/usr/local/cuda/lib64:/usr/local/cuda/lib:/usr/local/cuda/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/java/jre/lib/amd64/server:/opt/meituan/hadoop/lib/native
source /opt/rh/devtoolset-6/enable
最后查看新的gcc 版本
gcc -v
完美