当前位置: 首页 > news >正文

imx6ul Qt运行qml报错This plugin does not support createPlatformOpenGLContext!

imx6ul运行qml的Qt程序报错This plugin does not support createPlatformOpenGLContext!

  • 1、开发环境
  • 2、问题复现
  • 3、解决办法
      • 第一种方法
      • 第二种方法
  • 4、结论

1、开发环境

主板:imx6ul
Qt版本:5.9.6
文件系统:buildroot
问题描述:现需要在现有的文件系统中的Qt环境运行qml程序

2、问题复现

运行一个Qt自带的例程程序虚拟键盘输入Demo程序:basic
在这里插入图片描述
将basic程序交叉编译后放至imx6ul板子端运行,报以下错误:

root@imx6ul:~# ./basic
evdevtouch: /dev/input/event0: Invalid ABS limits, behavior unspecified
This plugin does not support createPlatformOpenGLContext!
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 1, profile  QSurfaceFormat::OpenGLContextProfile(NoProfile))
Aborted

这个错误大概是由于imx6ul本身是不带用GPU功能的,所以只能使用linuxfb插件,也就是说软件渲染。如果是使用qml去编写程序,需特别注意不能使用到Quick2。

3、解决办法

1、在Qt源码编译的时候,可以增加一个编译选项-no-opengl,这样就可以确保编译之后 不带有opengl的相关库,比如QtGraphicalEffects模块就不会再编译出来。

第一种方法

./configure -release \-xplatform linux-arm-gnueabi-g++ \-no-dbus \-no-opengl\    //添加此选项-prefix /home/hyb/qt-everywhere-opensource-src-5.9.1/arm-qt \-opensource -confirm-license -make libs \-nomake tools -nomake examples -nomake tests \-skip qt3d -skip qtandroidextras -skip qtcanvas3d \-skip qtconnectivity -skip qtdatavis3d -skip qtdoc \-skip qtgamepad -skip qtimageformats -skip qtlocation \-skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtsensors \-skip qtserialbus -skip qtspeech  -skip qttools -skip qtwebchannel \-skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras \-skip qtx11extras -no-feature-iconv -no-feature-gestures -no-qml-debug \-I/opt/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include

第二种方法

如果在第一种方法的前提下不加-no-opengl这个编译选项的话,在板子端执行大概率会报上述basic运行的错误,在查看Qt官网的相关资料,发现可以配置为软件渲染,通过设置环境变量来实现。

LinuxFB
This plugin writes directly to the framebuffer via Linux’s fbdev subsystem. Only software-rendered content is supported. Note that on some setups the display performance is expected to be limited. To use Qt Quick applications with this platform plugin, the software scenegraph backend must be used, either by setting QT_QUICK_BACKEND=software in the environment, or by calling setGraphicsApi() with QSGRendererInterface::Software. QWidget applications, or QWindow with a surface type of QSurface::RasterSurface, are supported, but this does not include special widgets such as QOpenGLWidget.

export QT_QUICK_BACKEND="software"

4、结论

通过以上方法后,basic的虚拟键盘程序就可以正常运行了。

http://www.dtcms.com/a/272973.html

相关文章:

  • 无人机抗风模块运行与技术难点分析
  • Flowable22变量监听器---------------持续更新中
  • OneFileLLM:一键聚合多源信息流
  • 股指期货交割交易日到期没平仓盈亏以哪个价格计算?
  • RP2040使用存储系统
  • 2025年7月10日泛财经要闻精选
  • ACPU正式启动全球化布局,重构AI时代的中心化算力基础施设
  • 基于cornerstone3D的dicom影像浏览器 第三十二章 文件夹做pacs服务端,fake-pacs-server
  • 专题 数字(Number)基础
  • pytorch深度学习-Lenet-Minist
  • (LeetCode 每日一题) 3440. 重新安排会议得到最多空余时间 II (贪心)
  • RabbitMQ消息队列——三个核心特性
  • LeetCode 1652. 拆炸弹
  • AI时代的接口调试与文档生成:Apipost 与 Apifox 的表现对比
  • Leetcode刷题营第十九题:对链表进行插入排序
  • Python 网络爬虫中 robots 协议使用的常见问题及解决方法
  • 图解 BFS 路径搜索:LeetCode1971
  • 芯片I/O脚先于电源脚上电会导致Latch-up(闩锁效应)吗?
  • Logback日志框架配置实战指南
  • 5种使用USB数据线将文件从安卓设备传输到电脑的方法
  • 【JavaScript 函数、闭包与 this 绑定机制深度解析】
  • 【C语言】指针笔试题2
  • 模块三:现代C++工程实践(4篇)第二篇《性能调优:Profile驱动优化与汇编级分析》
  • FlashAttention 快速安装指南(避免长时间编译)
  • QT网络通信底层实现详解:UDP/TCP实战指南
  • Centos 7下使用C++使用Rdkafka库实现生产者消费者
  • 【LeetCode 热题 100】19. 删除链表的倒数第 N 个结点——双指针+哨兵
  • 学习 Flutter (一)
  • html的outline: none;
  • C++STL-deque