报错详情:

报错详情

libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 150 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 156
Current serial number in output stream: 157

首先使用 LIBGL_DEBUG=verbose python test.py 执行,查看更详细调试信息。

更详细的报错信息

libGL: MESA-LOADER: failed to open /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so: /home/raykr/miniconda3/envs/carla/bin/…/lib/libstdc++.so: version `GLIBCXX_3.4.30’ not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so)
libGL: MESA-LOADER: failed to open $ORIGIN/dri/swrastdri.so:${ORIGIN}/dri/swrast_dri.so: \${ORIGIN}/dri/swrast_dri.so: cannot open shared object file: No such file or directory
libGL: MESA-LOADER: failed to open /usr/lib/dri/swrast_dri.so: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 150 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 156
Current serial number in output stream: 157

按照 version GLIBCXX_3.4.30' not found 搜索互联网,查询到一条解决方案:解决 libstdc++.so: version ‘GLIBCXX_3.4.30‘ not found 问题,可用。

核心思路是用其他有 GLIBCXX_3.4.30libstdc++.so.6 替换原有的软链接,解决方法如下:

1
2
3
4
5
6
# 查看新路径文件是否正常
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.30
# 先删除原本报错的文件
rm /home/raykr/miniconda3/envs/gym-carla/lib/libstdc++.so.6
# 重建软链接
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/raykr/miniconda3/envs/gym-carla/lib/libstdc++.so.6