Qrc file size issue
-
Hi all,
is there a maximum size for a qrc or the total number of qrc files within an application? I'm currently developing a Qt/QML application for the Nokia N8 and I'm running into problems when compiling due (I think) to the large number of images held by the qrc files.Thanks in advance
Angus
-
Well, <code>rcc</code> just generates source files out of the resources, which then have to be handled by the compiler. <code>gcc</code> for example maps files into memory, so it is limited by the available address space.
Try splitting your images into multiple resources or use resource compression if you compiler can't handle large files (although I doubt that you will exceed its limits).
-
Hi Lucas,
thanks for the reply. I have tried this approach, limiting each file to 400 images. Regardless of this, once I get to about 3000 images, the compiler fails. Is there a flag somewhere that allows me to increase the amount of memory assignable to qrc files? -
<code>.qrc</code> files do not contain any resources at all, they just contain a list of filenames of the resources. The resource compiler <code>rcc</code> takes this list of files and generates a <code>.cpp</code> file, which contains the binary representation of each resource in form of a plain <code>static const unsigned char[]</code> array. This <code>.cpp</code> files is then passed to the compiler to be compiled and linked along with the rest of your application.
So if you experience any limitations, it is a limitation of the compiler, not of any <code>.qrc</code> files or the resource compiler <code>rcc</code> (assuming that <code>rcc</code> generates valid source files).
What kind of image size are we talking here? Kilobytes, megabytes or even gigabytes?
What does "the compiler fails" mean? Are there any errors or warnings raised? Does it just segfault?
Which compiler do you use?
Is it possible that is is the linker and not the compiler which complains about the resulting binary or one if its sections beeing too large? -
Here is the actual compiler output :
FAILED linkandpostlink for arm.v5.urel.gcce4_4_1: epoc32\release\armv5\urel\HotelGuide.exe
mmp: HotelGuide_exe.mmp
mingw32-make[1]: *** [C:/QtSDK/Symbian/SDKs/Symbian3Qt473/epoc32/release/armv5/urel/HotelGuide.exe] Error 1
sbs: error: The make-engine exited with errors.
C:\QtSDK\Symbian\SDKs\Symbian3Qt473\epoc32\tools\make.exe: *** [release-gcce] Error 1
The process "C:\QtSDK\Symbian\SDKs\Symbian3Qt473\epoc32\tools\make.exe" exited with code 2.
Error while building project HotelGuide (target: Symbian Device)
When executing build step 'Make'As an Android/Java developer this is somewhat unhelpful, so any light you could shed on the issue would be gratefully received.
Thanks
Angus
-
Hi, let me take part in this conversation, as a new Qt dev user (this is my 1st post :).
Yesterday I experienced the same problem as angusrose. If I'm in GNU/Linux, g++ is ok and the project compiles well, but if in Windows, with mingw, it can't manage it.
I see the problem is that the way rcc has to generate the array as:
static const unsigned char qt_resource_name[] {...};
makes mingw unable to compile it. It's just a 55 Kb png image, and I suspect it can be related to a 64Kb problem of mingw. Apart from this, I did two "proofs of concept":- I took the array of the qrc_image.cpp and deleted lot of lines. I see it compiles.
- If, apart from the use of resources, you declare a big array in a function, say main(), like:
static const unsigned char qt_resource_name[] {...};
(Copy and paste the array of qrc_image.cpp)
you'll see the same problem: the file with main() doesn't compile
The solution I've used is to not include the png image as a resource and load it from the program. It works, but I think it's not elegant, and should be good if [from Qt?]:
a) This issue is verified. By the way, my version in Windows is 4.8 (in GNU/Linux it's 4.7)
b) Report this problem to mingw, or take another way to use rccThanks in advance
-
To solve the troubles with number of images on one of our projects, we downloaded a ZIP file on the first run and extracted it.
I dont know if this can help you