
在一台装有相当老旧的 Nvidia GeForce 9600 GT 和 Ubuntu 16.04.5 LTS MATE 并使用 Marco(Compton GPU Compositor)的计算机上,我安装了 ReText 文本编辑器,操作如下:
sudo apt-get install python3-pip
sudo -H pip3 install retext
并安装了最新的 7.0.4 版本。
它按预期工作,但如果我选择编辑→使用 WebEngine (Chromium) 渲染器要查看我的 Markdown 文档的实时预览,它会显示完全黑色的窗口,然后崩溃(崩溃结果不取决于其内容)。
终端中的崩溃日志是:
$ retext demo.md
QApplication: invalid style override passed, ignoring it.
Using configuration file: /home/norbert/.config/ReText project/ReText.conf
QFSFileEngine::open: No file name specified
[1013/141341.612478:WARNING:stack_trace_posix.cc(699)] Failed to open file: /tmp/.glx5hP6o (deleted)
Error: No such file or directory
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Received signal 11 SEGV_MAPERR 0000000001ad
#0 0x7f6cab07052f <unknown>
#1 0x7f6ca9aa1b1d <unknown>
#2 0x7f6cab070a3e <unknown>
#3 0x7f6cbc67d390 <unknown>
#4 0x7f6c5b302321 <unknown>
#5 0x7f6ca9b03c09 <unknown>
#6 0x7f6ca9aeec68 <unknown>
#7 0x7f6cabbac69d <unknown>
#8 0x7f6ca9df26d1 <unknown>
#9 0x7f6ca9df3ec5 <unknown>
#10 0x7f6cac062a67 <unknown>
#11 0x7f6cad87c605 <unknown>
#12 0x7f6cab0d8ee5 <unknown>
#13 0x7f6cab0d4280 <unknown>
#14 0x7f6cbc6736ba start_thread
#15 0x7f6cbc3a941d clone
r8: 0000000000000000 r9: 0000000000000000 r10: 00007f6c122d8e78 r11: 0000000000000000
r12: 00000000000000f5 r13: 000000000000000a r14: 000000000000009a r15: 000000000000000a
di: 0000000001d92264 si: 0000000000000001 bp: 00007f6c64ff8590 bx: 0000000001d8a6d0
dx: 0000000000000019 ax: 0000000001d92250 cx: 0000000000000001 sp: 00007f6c64ff8530
ip: 00007f6c5b302321 efl: 0000000000010202 cgf: 0000000000000033 erf: 0000000000000004
trp: 000000000000000e msk: 0000000000000000 cr2: 00000000000001ad
[end of stack trace]
Calling _exit(1). Core file will not be generated.
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
self.run()
File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.5/dist-packages/ReText/converterprocess.py", line 62, in _converter_process_func
job = receiveObject(conn_child)
File "/usr/local/lib/python3.5/dist-packages/ReText/converterprocess.py", line 31, in receiveObject
sizeBuf = recvall(sock, 4)
File "/usr/local/lib/python3.5/dist-packages/ReText/converterprocess.py", line 24, in recvall
raise EOFError('Received 0 bytes from socket while more bytes were expected. Did the sender process exit unexpectedly?')
EOFError: Received 0 bytes from socket while more bytes were expected. Did the sender process exit unexpectedly?
其他可能的行为是出现黑色窗口和终端中的以下重复文本:
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
Could not link shader program:
""
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed:
""
QOpenGLShaderProgram::uniformLocation(qt_Matrix): shader program is not linked
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed:
""
...
我怀疑是 OpenGL 导致了这个问题。但是swrast
驱动程序已经安装:
$ dpkg -S swrast
libgl1-mesa-dri:i386: /usr/lib/i386-linux-gnu/dri/kms_swrast_dri.so
libgl1-mesa-dri:amd64: /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libgl1-mesa-dri:i386: /usr/lib/i386-linux-gnu/dri/swrast_dri.so
libgl1-mesa-dri:amd64: /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so
驱动nvidia
程序已加载:
lsmod | grep nvidia
nvidia_uvm 36864 0
nvidia 10571776 50 nvidia_uvm
drm 364544 3 nvidia
并有 340 版本(最后一个遗产支持我的9600 GT):
$ modinfo nvidia_340 | head -n3
filename: /lib/modules/4.4.0-104-generic/updates/dkms/nvidia_340.ko
alias: char-major-195-*
version: 340.104
输出glxinfo | egrep -i "vendor|^direct"
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
VA 信息也可以:
$ vainfo
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.0)
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - 0.7.4
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
我还应该尝试什么来解决该问题?
笔记:
1. 这似乎是 OpenGL<->Xorg<->Qt 与 Nvidia 交互的问题。此 Chromium 预览版在配备 Intel i915 的笔记本电脑和配备 AMD/ATI APU 的台式机上均可正常运行。2
. 当然,来自官方存储库的版本(ReText 5.3.1(使用 PyMarkups 1.0.1))可以与两种渲染器(默认和 WebKit)一起正常运行。3
. 切换到软件合成器mate-tweak
无济于事。
答案1
解决方案是从 PyQt5 提供的 OpenGL 切换到 PyOpenGL。
所以我们需要使用以下命令安装此包pip3
:
sudo -H pip3 install PyQt5==5.9.2
sudo -H pip3 install PyOpenGL
我们需要/usr/local/bin/retext
在这里编辑并添加一行from OpenGL import GL
。我们可以通过编程来实现:
sudo sed -i "s/^from ReText.window import ReTextWindow$/from ReText.window import ReTextWindow\nfrom OpenGL import GL/" /usr/local/bin/retext
然后 ReText 应该可以正常工作,并且编辑器和预览将同步滚动。
我也提交了错误/功能请求通过 GitHub 发送给 ReText 开发人员。