一、问题描述
在使用linuxdeployqt打包发布Qt5.9.5开发的上位机界面程序后,在连接显示器的情况下能够正常启动上位机界面,在Ubuntu20.4版本下能够通过ssh -X远程登陆启动上位机界面,但是在Xavier平台下的Ubuntu18.04通过ssh -X远程登陆却无法启动上位机界面。报错信息如下:
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
二、出现问题的原因:
Qt的xcb版本与Ubuntu系统版本不匹配造成X11不支持OpenGL的转发。
三、解决方法:
1、linuxdeployqt打包的文件夹内容如下:
2、将plugins文件夹及其内容替换成Qt5.9.9版本下的plugins。
3、具体造成OpenGL转发失败的依赖库是
plugins->xcbglintegrations文件内的libxcb-库需要替换成Qt5.9.9版本下的库