Solved Cannot load statically-linked qoffscreen platform plugin
-
I am trying to load the offscreen plugin from a statically linked Qt application. The qcocoa plugin loads fine and both static plugin libs are successfully linked into the app> But when I set QT_QPA_PLATFORM=offscreen in the environment, I get this:
kernel/qguiapplication.cpp:1199:void init_platform(const QString &, const QString &, const QString &, int &, char **)(): Could not find the Qt platform plugin "offscreen" in "" kernel/qguiapplication.cpp:1223:void init_platform(const QString &, const QString &, const QString &, int &, char **)(): This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: cocoa.
FWIW, my python unit tests are stalling somewhere in my own C++ code when I set QT_QPA_PLUGIN=offscreen and I am trying to debug it in my Xcode project which is generated via qmake target, which is set up as a static app.
-
@patrickkidd said in Cannot load statically-linked qoffscreen platform plugin:
Maybe you have to explicitly register the plugin
Why not try out and follow the instructions: https://doc.qt.io/qt-5/plugins-howto.html#static-plugins
"qmake automatically adds the plugins to QTPLUGIN that are typically needed by the Qt modules used (see QT), while more specialized plugins need to be added manually. The default list of automatically added plugins can be overridden per type. For example, to link the minimal plugin instead of the default Qt platform adaptation plugin, use:"
-
Hi,
Did you build the offscreen plugin as part of Qt's build ?
-
@SGaist said in Cannot load statically-linked qoffscreen platform plugin:
Hi,
Did you build the offscreen plugin as part of Qt's build ?
libqoffscreen.a linked successfully into the app binary. Unless you are referring to some other build option.
-
I meant: did you enable the offscreen plugin when building your static Qt ? Or did you compile it afterward ?
Right now I am not sure whether it's built by default.
-
@SGaist said in Cannot load statically-linked qoffscreen platform plugin:
I meant: did you enable the offscreen plugin when building your static Qt ? Or did you compile it afterward ?
Right now I am not sure whether it's built by default.
The static plying was built along with the rest of qt.
-
@patrickkidd said in Cannot load statically-linked qoffscreen platform plugin:
@SGaist said in Cannot load statically-linked qoffscreen platform plugin:
I meant: did you enable the offscreen plugin when building your static Qt ? Or did you compile it afterward ?
Right now I am not sure whether it's built by default.
The static plying was built along with the rest of qt.
Maybe you have to explicitly register the plugin when it is linked statically, and the default plugin is registered by default?
-
@patrickkidd said in Cannot load statically-linked qoffscreen platform plugin:
Maybe you have to explicitly register the plugin
Why not try out and follow the instructions: https://doc.qt.io/qt-5/plugins-howto.html#static-plugins
"qmake automatically adds the plugins to QTPLUGIN that are typically needed by the Qt modules used (see QT), while more specialized plugins need to be added manually. The default list of automatically added plugins can be overridden per type. For example, to link the minimal plugin instead of the default Qt platform adaptation plugin, use:"
-
@Christian-Ehrlicher said in Cannot load statically-linked qoffscreen platform plugin:
@patrickkidd said in Cannot load statically-linked qoffscreen platform plugin:
Maybe you have to explicitly register the plugin
Why not try out and follow the instructions: https://doc.qt.io/qt-5/plugins-howto.html#static-plugins
"qmake automatically adds the plugins to QTPLUGIN that are typically needed by the Qt modules used (see QT), while more specialized plugins need to be added manually. The default list of automatically added plugins can be overridden per type. For example, to link the minimal plugin instead of the default Qt platform adaptation plugin, use:"
Adding
QTPLUGIN.platforms += qoffscreen
madeQT_QPA_PLATFORM=offscreen
work. Thanks!Now on to all the other problems running my code in offscreen mode...