Errors with qmlcachegen
-
Hello all,
we are using Qt 6.4.3.
Everything was fine until we added a 'qt_add_qml_module()' to our CMAKE-based project.
Now I am having the following problems:
Firstly, the QML script compiler (qmlcachegen?) is producing a lot of warnings and errors.
For example:Warnings occurred while importing module "QtQuick.Controls": import QtQuick.Controls as QQC ^^^^^^ --- Warning: QtQuick.Controls uses optional imports which are not supported. Some types might not be found.
Also, tons of errors about "shadowing":
Error: Could not compile binding for checkedColor: Member graphColor of QObject of Style::colorScheme with type ColorScheme can be shadowed
Secondly, the generated cpp-files contain many #include directives which are then unresolvable for the C++ compiler. For example, one generated file contains the following lines:
#include <private/qqmlbuiltinfunctions_p.h> #include <private/qqmlengine_p.h> #include <private/qqmllistmodel_p.h> #include <private/qqmlmodelsmodule_p.h> #include <private/qqmlvaluetype_p.h> #include <private/qquickimplicitsizeitem_p.h> #include <private/qquickpopup_p.h> #include <private/qquickrectangle_p.h> #include <private/qquicktext_p.h> #include <private/qquickvaluetypes_p.h>
And here's the weirdest part: all of my collegues using the same project have no problems at all building it!
Obviously, something is configured differently on my machine.I'd by grateful for any pointers where to look!
-
What you describe is weirdly reminiscent of a problem I ran into recently with Qt5 when I upgraded my OS from Ubuntu 20 to Ubuntu 22.
On the surface, nothing you describe matches precisely with my issue (which you can view here, just for curiosity's sake: https://askubuntu.com/a/1486532/231504)
However, my gut says that they might both boil down to a similar root cause, which is:
- you might have several copies of Qt headers and Qt libs in several spots
- "something" in your configure/generate/make/compile/link/launch chain is not using the copy that you really need it to use.
If you could "start clean" (perhaps even in a clean, fresh VM if you are so inclined), then I suspect (especially since nobody else on your project has this issue)... I suspect if you:
- start in a clean environment
- install exactly one copy of Qt in exactly one spot
- build with that copy of Qt
You will probably be ok.
This is one of those times where it sounds crazy and sounds like too much effort to "wipe and reinstall" everything. However, depending on how many hours you spend trying to tease apart your current issue, it's hard to really say what is crazier and longer in the end!
-
@KH-219Design Thank you for your reply!
Your suggestion about more than one Qt-installation being present is definitely sound advice!
I've found an old Qt-5 installation which I have now purged.
I've also double-checked the path of the Qt-tools being used, including the cmake-executable.
So far, that hasn't eliminated the problems, but I'll keep digging in that direction.
Thanks again.