1

I'm running into a problem where the rcc compiler throws a "C1060: compiler is out of heap space"

Unfortunately I cannot use .pro files so am unable to use the following suggestion using the big resource flag

When looking for a work-around, I noticed the "-t" option in the Qt documentation of the rcc compiler. It alludes to using this option when dealing with "big resources" but doesn't go into any details.

Can someone suggest how to actually use this option?

My current rcc arguments: C:\Qt\Qt5.6.3\5.6.3\msvc2015\bin\rcc.exe -threshold 70 -compress -1 -name "%(Filename)" -o ".\_qt\win\qrc_%(Filename).cpp" "%(FullPath)"

Tom
  • 248
  • 1
  • 6
  • 16
  • 1
    As the documentation states: `-t ` or `--temp `. Did you try ? (perhaps I've misundertood you question) – Fareanor Oct 30 '19 at 12:55
  • @Fareanor Yes, I have tried giving it several file names and extensions, including cpp, rcc and qrc but it gives either an "Unknown error" or "Failed to read", it seems to make no difference whether these files exist or not. The question is more aimed at what the option actually does – Tom Oct 30 '19 at 13:11
  • @Tom which build system are you using? – Super-intelligent Shade Dec 16 '21 at 19:13

1 Answers1

0

I had the same problem and the way I figured out how to use this option was to observe how Qt Creator calls rcc.exe when using CONFIG += resources_big in the .pro file. In the Compile Output view you can see the exact parameters used during the build.

Based on this, --temp <file> is part of a 3-step process so you can't really use it on its own. Let's assume that Visual Studio 2017 is used with Qt 5.12.7 on Windows 10, and the bin folders are in the Path. For simplicity's sake let's say you have a cmd open in you project folder, you have a build folder named debug there and a resource definition file resources.qrc which includes about 50MB of arbitrary data. In this case the 3-step resource compilation would look something like this:

rcc.exe resources.qrc -pass 1 -o debug/qrc_resources.cpp
cl.exe -c debug/qrc_resources.cpp -Fodebug/qrc_resources.tmp.obj
rcc.exe resources.qrc -pass 2 -temp debug/qrc_resources.tmp.obj -o debug/qrc_resources.obj
  • Step 1 creates debug/qrc_resources.cpp which contains an empty array definition for 50MB data. This is a much smaller cpp file than what a more traditional rcc.exe call would generate (it would be ~300MB) since it does not include any actual data. This way cl.exe won't choke on a big cpp file.
  • Step 2 compiles this cpp file into debug/qrc_resources.tmp.obj.
  • Step 3 fills up the empty array in debug/qrc_resources.tmp.obj with the actual data that is defined in resources.qrc and outputs it into debug/qrc_resources.obj. This object file can then be used by the linker to create an executable or library.

If you use Visual Studio then Qt VS Tools version >= 2.5.0 can do this for you. You can set the Qt Resource Compiler as Item Type for the qrc file and set the Two-Pass Mode property to true.

Or you can try to create your own build steps based on the above code.

Everlight
  • 116
  • 5