`Project ERROR: Unknown module(s) in QT: gui` Even when QtGui not configured in
-
wrote on 5 Oct 2022, 22:59 last edited by patrickkidd 10 May 2022, 23:01
It looks like
QT += gui
is added implicitly in qmake projects. At least in 5.15.2. This throws the error:Project ERROR: Unknown module(s) in QT: gui
. AddingQT -= gui
fixes the problem. But my.pro
files are auto-generated (by sip) so I can't add a line to the end of them. So how is it possible to prevent Qt from implicitly addinggui
toQT
whenQtGui
is not configured to build?configure line:
./configure -opensource -confirm-license -release -nomake examples -nomake tests -prefix $HOME/qt -no-feature-concurrent -no-feature-dbus -no-feature-network -no-feature-sql -no-feature-testlib -no-feature-xml -no-gif -no-libjpeg -no-mtdev -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-xcb -qt-freetype -no-fontconfig -no-harfbuzz -no-xcb-xlib -no-cups -no-iconv -no-icu -no-eglfs -no-gui -no-widgets -no-feature-gui -skip qtgui -skip qtactiveqt -skip qtcanvas3d -skip qtgamepad -skip qtremoteobjects -skip qtscript -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebview -skip qtnetwork
notice:
-no-gui -no-widgets -no-feature-gui -skip qtgui
Example qmake file that breaks:
TEMPLATE = app SOURCES = main.cpp
And file that works:
TEMPLATE = app SOURCES = main.cpp QT -= gui
At the end of the day, all I'm trying to do is build a qt make and lib that has qtcore and nothing else. For backward compatibility I just need to use a library that uses qbytearray and no other classes. If there is a cleaner way to configure qt that would be great. But the configure line above is the best I can come up with.
-
It looks like
QT += gui
is added implicitly in qmake projects. At least in 5.15.2. This throws the error:Project ERROR: Unknown module(s) in QT: gui
. AddingQT -= gui
fixes the problem. But my.pro
files are auto-generated (by sip) so I can't add a line to the end of them. So how is it possible to prevent Qt from implicitly addinggui
toQT
whenQtGui
is not configured to build?configure line:
./configure -opensource -confirm-license -release -nomake examples -nomake tests -prefix $HOME/qt -no-feature-concurrent -no-feature-dbus -no-feature-network -no-feature-sql -no-feature-testlib -no-feature-xml -no-gif -no-libjpeg -no-mtdev -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-xcb -qt-freetype -no-fontconfig -no-harfbuzz -no-xcb-xlib -no-cups -no-iconv -no-icu -no-eglfs -no-gui -no-widgets -no-feature-gui -skip qtgui -skip qtactiveqt -skip qtcanvas3d -skip qtgamepad -skip qtremoteobjects -skip qtscript -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebview -skip qtnetwork
notice:
-no-gui -no-widgets -no-feature-gui -skip qtgui
Example qmake file that breaks:
TEMPLATE = app SOURCES = main.cpp
And file that works:
TEMPLATE = app SOURCES = main.cpp QT -= gui
At the end of the day, all I'm trying to do is build a qt make and lib that has qtcore and nothing else. For backward compatibility I just need to use a library that uses qbytearray and no other classes. If there is a cleaner way to configure qt that would be great. But the configure line above is the best I can come up with.
@patrickkidd said in `Project ERROR: Unknown module(s) in QT: gui` Even when QtGui not configured in:
It looks like
QT += gui
is added implicitly in qmake projects.Yes, this is specified in the documentation: https://doc.qt.io/qt-6/qmake-variable-reference.html#qt
But my
.pro
files are auto-generated (by sip) so I can't add a line to the end of them.
So how is it possible to prevent Qt from implicitly addinggui
toQT
whenQtGui
is not configured to build?You have 2 options:
- Don't skip the Qt GUI module, OR
- Modify the qmake source code before building, to stop it from adding
gui
by default (I don't know where this code is)
-
@JKSH is right, this is documented behavior, so the generator should be ideally adapted.
The code that adds core and gui by default to QT is in mkspecs/features/spec_pre.prf . You could modify this file directly (breaking behavior for all other qmake apps), set up your own profile / .prf file, or reset the content of QT on the command line:
qmake -after QT=core
1/3