Details
-
User Story
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
None
-
None
Description
Problem
The Qt Resource System struggles with embedding big resources into binary files.
- If files become to big, the compiler might choke, resulting in build failures. There's a hack in qmake (CONFIG += big_resources), which however is not supported yet in CMake, or qbs. Nor is it supported for iOS.
- Compiling in large resources will result in unneccessarily long build times.
- Link time optimizations (-lto for gcc) break the big_resource approach.
Business Value
Since Qt 4 times we have been putting the Qt Resource System more and more into the center of deployment - because we lack a good cross-platform deployment story, Qt examples and wizards extensively use the Qt Resource System nowadays for Qt Quick assets. With the last focus on asset conditioning this is becoming even more relevant.
Background
The Qt Resource System consists of the rcc binary that processes .qrc files. Most commonly, the binary resources are then placed in the program's executable. Finally, there are enablers in qmake, cmake, qbs to conveniently set this up.
There are issues with this approach though. The biggest one is that, when embedding into binaries, rcc actually generates structures in .cpp files that are then processed by the C++ compiler. If the data becomes too big, the compiler will not swallow this anymore.
Rcc currently features a 'hack' in that the .cpp files only contain placeholders; rcc will directly write the data into the generated .o file afterwards. Anyhow, this hack is only featured in qmake so far. Every build system we support has to be extended to support this.
Proposals
Let CMake, qbs, ... also adapt the big_resources solution for qmake. This won't solve the lto issue though.
Use assembler to embed binary resources, avoiding the need for a 'second pass' of rcc. This is supported for gcc and clang, and actually any other compiling gcc assembly, with the .incbin directive. Unfortunately there doesn't seem to exist a similar construct for MSVC.
Change the build system defaults to not embed resources directly into the executable, but in separate .rcc files. These files have to be located automatically and deployed though.
Attachments
Issue Links
- relates to
-
QTBUG-39612 Qt / QtC's rcc/qrc aging ungracefully, Qt lacks decent resource modularity.
-
- Reported
-
-
QTBUG-41301 2-Pass version of rcc does not work when using link-time optimization
-
- Reported
-
-
QTBUG-55680 Compiling "large" qrc resources within CMake build causes heap allocation errors
-
- Closed
-
-
QTBUG-39835 qrc: add support for "large resources" on iOS
-
- Closed
-
-
QTBUG-39612 Qt / QtC's rcc/qrc aging ungracefully, Qt lacks decent resource modularity.
-
- Reported
-