Large number of PNG resources --> [qrc_resources.cpp] Segmentation fault: 11
-
I am developing a desktop application that contains many animations. I am developing the program on an Apple iMac.
The QT project includes a qml.qrc file that references 10 qml files. The project also contains a resources.qrc file that references png files. The resources.qrc file does not reference any missing files.
Until today, the resources.qrc file referenced about 50mb of png files. The program development was without any issues. However, today, I added I added an additional 460mb of "production" png files. To be precise, there are 2,089 png files having a cumulative size of 504mb.
Now, when I attempt to build the project, I receive the following error:
"[qrc_resources.cpp] Segmentation fault: 11"
I have reviewed the contents of the resources.qrc file, and I see nothing amiss.
Is there a limit to the number of files or the cumulative size of files that can be referenced by a qrc file? Should I spread my png files out among a large number of separate qrc files?
Thank you in advance.
Hoyt
-
Hi!
The size limit depends on your C++ compiler: The resource file (*.qrc) is only a XML file that lists all the PNGs etc you added to it. Then comes Qt's resource compiler into play: It generates a C++ file for each XML file. These C++ files contain a C array for each of the listed files (PNGs etc). These C arrays contain the binary data of that files (PNGs etc). So, the more data (more files, bigger files) you add to a resource file, the bigger the corresponding C++ file will become. And your C++ compiler (MSVC, gcc, etc) usually can't handle arbitrary huge files.
Long story short: Don't compile huge amounts of data into your executable; better put them in a folder and deploy that along with your executable. (Or, if you want to "protect" them, put them in a zip archive.)
-
@Hoyt, in addition to @Wieland, you should use external resources and not compile everything into 500MB executable files. This thread from the mailing list will help you get your bearings.