Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.12.5
-
None
Description
When having a .js file in the resources and compiling the (qmake-based) project in release mode, qmake generates a QML cache file with a precompiled version of the .js file (I think - I never got in touch with this feature). However, if a project doesn't use Qml, this leads to a linker error since the generated qmlcache_loader.cpp calls some interal Qml registration functions.
Besides the question, wether or not all .js files in the resource systems should be precompiled during compile time of the project - independently of wether or not they are actually used in the Qml engine later at runtime, or "just" resources for some other reason (like in my case) - it only makes sense to actually generate the QmlCache / precompile the js files if the project also makes use of the Qml module.
I therefore request that this feature is only enabled if the project uses the Qml module. (At least I think that this might be a solution to this.)
Minimal example (see also attachments):
- Start with an empty Qt console application (qmake-based)
- Add a resource file and add some arbitrary js file
- Compile in release mode
I suspect that the same happens when adding a .qml file to the resource system, but I didn't test it. In my case, the project contains a .js file for use in a web application, so its context is not the Qml world. I guess answering the question above, i.e. wether or not the .js is used in Qml, cannot be answered during compile time, so if the project uses Qml but also has some Qml-unrelated .js files, they are precompiled unneccessarily, but I guess this doesn't hurt so much (compared to the linker error when no Qml is used at all).
Attachments
Issue Links
- duplicates
-
QTBUG-73669 Adding *.js to resources of project without QML leads to linker error
- Closed