Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qrc file size issue
Qt 6.11 is out! See what's new in the release blog

Qrc file size issue

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 4 Posters 11.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    angusrose
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      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).

      1 Reply Last reply
      0
      • A Offline
        A Offline
        angusrose
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          Wait, are we talking about a C++ compiler here or the resource compiler <code>rcc</code>?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            angusrose
            wrote on last edited by
            #5

            I'm referring to the C++ compiler (make.exe??) I'm not from a C++ background btw.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              <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?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                angusrose
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lgeyer
                  wrote on last edited by
                  #8

                  Please post - or better - pastebin the full compile log, the part you've posted does not contain the actual error.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    danitxu
                    wrote on last edited by
                    #9

                    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":

                    1. I took the array of the qrc_image.cpp and deleted lot of lines. I see it compiles.
                    2. 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 rcc

                    Thanks in advance

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      GentooXativa
                      wrote on last edited by
                      #10

                      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

                      Jose Vicente Giner Sanchez - Senior Mobile Developer

                      www.gigigo.com

                      C/ Dr. Zamenhof 36bis, 1ºA 28027 Madrid
                      T: +34 917431436

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved