Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt5: qmlcachegen.exe: Bad address #1584

Open
LigH-de opened this issue Mar 20, 2020 · 14 comments
Open

Qt5: qmlcachegen.exe: Bad address #1584

LigH-de opened this issue Mar 20, 2020 · 14 comments

Comments

@LigH-de
Copy link
Contributor

LigH-de commented Mar 20, 2020

Sometimes when compiling a Qt5 project for the first time, one of the projects fails creating cache files. One example:

...
ccache g++ -c -fno-keep-inline-dllexport -O2 -std=c++1z -fno-exceptions -Wall -Wextra -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -Wno-format-overflow -ffunction-sections -fdata-sections -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_LINKED_LIST -DQT_NO_FOREACH -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_LINKED_LIST -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN_RESOURCE_INIT_FUNCTION=qtquickcontrols2imaginestyleplugin_plugin_resource_init -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_QUICKTEMPLATES2_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -isystem E:/MABS/local32/include/QtQuick -isystem E:/MABS/local32/include/QtGui -isystem E:/MABS/local32/include/QtQmlModels -isystem E:/MABS/local32/include/QtQml -isystem E:/MABS/local32/include/QtNetwork -isystem E:/MABS/local32/include/QtCore -I../../../../include/QtQuickTemplates2/5.14.2 -I../../../../include/QtQuickTemplates2/5.14.2/QtQuickTemplates2 -I../../../../include -I../../../../include/QtQuickTemplates2 -I../../../../include/QtQuickControls2/5.14.2 -I../../../../include/QtQuickControls2/5.14.2/QtQuickControls2 -I../../../../include/QtQuickControls2 -isystem E:/MABS/local32/include/QtQuick/5.14.2 -isystem E:/MABS/local32/include/QtQuick/5.14.2/QtQuick -isystem E:/MABS/local32/include/QtGui/5.14.2 -isystem E:/MABS/local32/include/QtGui/5.14.2/QtGui -isystem E:/MABS/local32/include/QtQmlModels/5.14.2 -isystem E:/MABS/local32/include/QtQmlModels/5.14.2/QtQmlModels -isystem E:/MABS/local32/include/QtQml/5.14.2 -isystem E:/MABS/local32/include/QtQml/5.14.2/QtQml -isystem E:/MABS/local32/include/QtCore/5.14.2 -isystem E:/MABS/local32/include/QtCore/5.14.2/QtCore -I.moc/release -IE:/MABS/local32/mkspecs/win32-g++  -o .obj/release/Popup_qml.o .qmlcache/release/Popup_qml.cpp
'E:\MABS\local32\bin\qmlcachegen.exe' --resource-file-mapping=E:/MABS/build/qtquickcontrols2-git/src/imports/controls/imagine/.rcc/release/qmake_QtQuick_Controls_2_Imagine.qrc=E:/MABS/build/qtquickcontrols2-git/src/imports/controls/imagine/.rcc_release_qmake_QtQuick_Controls_2_Imagine_qmlcache.qrc -o .qmlcache/release/qmlcache_loader.cpp .rcc/release/qmake_QtQuick_Controls_2_Imagine.qrc
make[4]: E:\MABS\local32\bin\qmlcachegen.exe: Bad address
make[4]: *** [Makefile.Release:387: .qmlcache/release/qmlcache_loader.cpp] Error 127
make[4]: Leaving directory '/build/qtquickcontrols2-git/src/imports/controls/imagine'
make[3]: *** [Makefile:55: release-install] Error 2
make[3]: Leaving directory '/build/qtquickcontrols2-git/src/imports/controls/imagine'
make[2]: *** [Makefile:194: sub-controls-imagine-imagine-pro-install_subtargets] Error 2
make[2]: Leaving directory '/build/qtquickcontrols2-git/src/imports'
make[1]: *** [Makefile:115: sub-imports-install_subtargets] Error 2
make[1]: Leaving directory '/build/qtquickcontrols2-git/src'
make: *** [Makefile:64: sub-src-install_subtargets] Error 2

logs.zip

You can find this issue reported for MSYS2 in several locations, one is "monero". They made an interesting discovery and created a workaround by including a shell script as source. One suspects the reason in the MinGW version of make.

@LigH-de
Copy link
Contributor Author

LigH-de commented Mar 30, 2020

Please advise how to make progress here. I tried mentioning this in #msys2 IRC but got no reply at that time.

@1480c1
Copy link
Member

1480c1 commented Mar 30, 2020

I'm not sure atm as I haven't had time to test and debug anything, one thing you might want to do if you have time and will power to look at qt stuff is find any mention of qmlcache under the qt folders or under the local folder and look for a file that ends or begins with pf, it's been a while since I looked for it to fix the same error for another qml* program

@LigH-de
Copy link
Contributor Author

LigH-de commented Mar 31, 2020

I guess you might mean: local32/mkspecs/features/qmlcache.prf

@selsta
Copy link

selsta commented May 23, 2020

You can find this issue reported for MSYS2 in several locations, one is "monero".

We weren’t able to properly fix this yet. The workaround does not work in all cases.

@1480c1
Copy link
Member

1480c1 commented May 23, 2020

based on my guesses, the main reason why this occurs is that upstream qt does not consider msys2+mingw-w64 a supported configuration, so they hardcode assumptions for the windows platform

@1480c1
Copy link
Member

1480c1 commented May 23, 2020

Rather they even mislabeled mingw-w64 as MinGW, which can be considered an offense to both projects.

https://doc.qt.io/qt-5/windows.html#supported-configurations

@selsta
Copy link

selsta commented May 24, 2020

We mostly had this problem with Windows CI. As a workaround we disabled qtquickcompiler: monero-project/monero-gui#2921

@1480c1
Copy link
Member

1480c1 commented May 24, 2020

Now I wonder if we can do that with qt5 and vlc

@NewEraCracker
Copy link

NewEraCracker commented Jul 9, 2020

There may be some other workarounds. I'll share what I tried so far and works in other project where I use Qt and I have the same error message

One way: Standalone build of the loader with command below and then re-running the build process

cd build && make -f Makefile.Release compiler_qmlcache_loader_make_all && cd ..

Another way: Add a small delay before calling qmlcachegen

Find in the build\Makefile.Release

release/qmlcache_loader.cpp: ../qml.qrc

Replace:

/C/msys64/mingw64/bin/qmlcachegen.exe

With:

sleep .5 && /C/msys64/mingw64/bin/qmlcachegen.exe

@1480c1
Copy link
Member

1480c1 commented Jul 9, 2020

Are the makefiles that bad?

Do they not have the target dependencies properly set?

@NewEraCracker
Copy link

Seems to be an issue with Qt running on MSYS.

Also as an update, the sleep hack isn't working sometimes either. What I've seen working is either running the failing command manually or doing it through the compiler_qmlcache_loader_make_all task.

@LigH-de
Copy link
Contributor Author

LigH-de commented Jul 9, 2020

Maybe some background task in Windows (e.g. Defender or an Explorer extension) blocks access to files just long enough to annoy an MSYS2 task.

@1480c1
Copy link
Member

1480c1 commented Sep 25, 2020

I think I might have a fix for this, by making qt5 build those tools as static as mentioned https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

I think it might be that those tools were loading the wrong dlls

@lazka
Copy link

lazka commented Dec 27, 2020

similar error here: msys2/MINGW-packages#7528 (comment) so likely a msys2 runtime bug

export MSYS2_ARG_CONV_EXCL='--resource-file-mapping=' might work around it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants