实际上这次的情况有一些复杂,首先这个集群上跑的是活化石Cent OS,也就是说环境非常的古老(硬件倒是最新的),GCC还是4.8.5,甚至编译不了最新的DGL库。更悲伤的是我并没有这个公用集群的管理员权限,只能想方设法去绕开权限去安装软件,因此我用Conda装了CMake,GCC和G++。所以解决version GLIBCXX_3.4.20 not found这个问题就更加麻烦了,因此这篇文章的解决方法并不适用所有的情况,但可以作为一个参考。
注:用Conda无权限安装GCC等软件的方式非常简单
1 2 3 4 5 6 7 8 9 10 11 12 13
# Create and activate a Conda environment named DGL conda create -n dgl conda activate dgl
# Add a channel called Conda-Forge conda config --add channels conda-forge
# Install the software conda install gxx_linux-64 gcc_linux-64 cmake
# Verify whether GCC is working echo$CC# Should not be the default one (like /usr/bin/gcc) echo$CXX
Traceback (most recent call last): File "<string>", line 1, in <module> File "/work/gutz/miniconda3/envs/dgl/lib/python3.8/site-packages/dgl-0.6-py3.8-linux-x86_64.egg/dgl/__init__.py", line 13, in <module> from .backend import load_backend, backend_name File "/work/gutz/miniconda3/envs/dgl/lib/python3.8/site-packages/dgl-0.6-py3.8-linux-x86_64.egg/dgl/backend/__init__.py", line 96, in <module> load_backend(get_preferred_backend()) File "/work/gutz/miniconda3/envs/dgl/lib/python3.8/site-packages/dgl-0.6-py3.8-linux-x86_64.egg/dgl/backend/__init__.py", line 41, in load_backend from .._ffi.base import load_tensor_adapter # imports DGL C library File "/work/gutz/miniconda3/envs/dgl/lib/python3.8/site-packages/dgl-0.6-py3.8-linux-x86_64.egg/dgl/_ffi/base.py", line 45, in <module> _LIB, _LIB_NAME, _DIR_NAME = _load_lib() File "/work/gutz/miniconda3/envs/dgl/lib/python3.8/site-packages/dgl-0.6-py3.8-linux-x86_64.egg/dgl/_ffi/base.py", line 35, in _load_lib lib = ctypes.CDLL(lib_path[0]) File "/work/gutz/miniconda3/envs/dgl/lib/python3.8/ctypes/__init__.py", line 381, in __init__ self._handle = _dlopen(self._name, mode) OSError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /work/gutz/miniconda3/envs/dgl/lib/python3.8/site-packages/dgl-0.6-py3.8-linux-x86_64.egg/dgl/libdgl.so)