解决 pygame 运行时找不到 swrast 和 GLIBCXX_3.4.30 的错误
报错详情:
报错详情
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/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.30
的 libstdc++.so.6
替换原有的软链接,解决方法如下: