QT_DEBUG_PLUGINS=1

Qt的编程中包含了插件模式,使得程序的扩展性非常好,但插件的动态加载的检查也比较严格,这次编译数据库驱动插件就碰到了不少问题。实际上,可以在系统的 环境变量中设置QT_DEBUG_PLUGINS=1 ,即在终端中执行 export QT_DEBUG_PLUGINS=1

再执行程序加载插件时,再系统控制台上会输出许多加载插件时的调试信息,可以清楚的看到系统尝试加载了哪些插件,哪些是成功的,哪些没有成功,原因是什么都写的比较清楚。因此,如果自己编译的插件库无法加载,可以用这个方式检查以下到底是哪里的问题。

//-------------------------------------

在没有添加QT_DEBUG_PLUGINS=1时,运行程序:

Open: "/dev/ttyO1"
Open: "/dev/ttyO4"
+++++++++++++++++++++++++++++++++++++++++++++++++++.
++++++++++++++++++++++++Create Command Thread.....
+++++++++++++++++++++++++++++++++++++++++++++++++++.
defaultServiceProvider::requestService(): no service found for - "org.qt-project
.qt.audiosource"
Input Devices Can Used :
()
===========

Default Input Devices :
""
-------------------

Encoder:

//-------------------------------------

 

 

添加QT_DEBUG_PLUGINS=1(即在即在终端中执行 export QT_DEBUG_PLUGINS=1)

//-------------------------------------

Open: "/dev/ttyO1"
Open: "/dev/ttyO3"
Open: "/dev/ttyO4"
QFactoryLoader::QFactoryLoader() checking directory path "/workspace/mediaservic
e" ...
QFactoryLoader::QFactoryLoader() looking at "/workspace/mediaservice/libqtmedia_
audioengine.so"
+++++++++++++++++++++++++++++++++++++++++++++++++++.
++++++++++++++++++++++++Create Command Thread.....
+++++++++++++++++++++++++++++++++++++++++++++++++++.
QElfParser: '/workspace/mediaservice/libqtmedia_audioengine.so' is an invalid EL
F object (string table seems to be at a100)
"'/workspace/mediaservice/libqtmedia_audioengine.so' is an invalid ELF object (s
tring table seems to be at a100)"
         not a plugin
defaultServiceProvider::requestService(): no service found for - "org.qt-project
.qt.audiosource"
Input Devices Can Used :
()
===========

Default Input Devices :
""
-------------------

 

可以看到 提示的更详细,libqtmedia_audioengine.so 有问题,再排查吧

 

果然 重新换一下这个so 再运行 就正常了。。。

posted @ 2021-05-07 08:51  伟大的厨师  阅读(4437)  评论(0编辑  收藏  举报