QResource::registerResource failing
-
I am trying to load a binary resource file at runtime from an application built on Windows 10 using Qt 5.12.9. The resource file was built on Linux using Qt
"rcc"tool, but using version 5.15.3.The function
QResource::registerResource()returnsfalseusing this file, which was compiled with the-binarycommand-line switch. After recompiling the same*.qrcfile with the Windowsrcc.exeof version 5.12.9, I could successfully load the file.With earlier versions than 5.15, I never had this problem. Comparing the file sizes of the two binary files, the ones compiled with 5.15.3 on Linux are four bytes larger than the ones compiled on Windows with 5.12.9.
I haven't yet tried to load the earlier versions with the application on Linux built with 5.15. If this succeeds, then I will use those. But it seems strange that the RCC format would change between 5.12 and 5.15?
-
I am trying to load a binary resource file at runtime from an application built on Windows 10 using Qt 5.12.9. The resource file was built on Linux using Qt
"rcc"tool, but using version 5.15.3.The function
QResource::registerResource()returnsfalseusing this file, which was compiled with the-binarycommand-line switch. After recompiling the same*.qrcfile with the Windowsrcc.exeof version 5.12.9, I could successfully load the file.With earlier versions than 5.15, I never had this problem. Comparing the file sizes of the two binary files, the ones compiled with 5.15.3 on Linux are four bytes larger than the ones compiled on Windows with 5.12.9.
I haven't yet tried to load the earlier versions with the application on Linux built with 5.15. If this succeeds, then I will use those. But it seems strange that the RCC format would change between 5.12 and 5.15?
Apparently, the older RCC files compiled on Windows are opened without any problems on the newer Linux Qt installation, so I will wait a few more days for more feedback and then mark this as "SOLVED"
-
I am trying to load a binary resource file at runtime from an application built on Windows 10 using Qt 5.12.9. The resource file was built on Linux using Qt
"rcc"tool, but using version 5.15.3.The function
QResource::registerResource()returnsfalseusing this file, which was compiled with the-binarycommand-line switch. After recompiling the same*.qrcfile with the Windowsrcc.exeof version 5.12.9, I could successfully load the file.With earlier versions than 5.15, I never had this problem. Comparing the file sizes of the two binary files, the ones compiled with 5.15.3 on Linux are four bytes larger than the ones compiled on Windows with 5.12.9.
I haven't yet tried to load the earlier versions with the application on Linux built with 5.15. If this succeeds, then I will use those. But it seems strange that the RCC format would change between 5.12 and 5.15?
@Robert-Hairgrove I check the Qt source code of the rcc tool, apparently there does have new format from 5.12 to 5.15.
https://github.com/qt/qtbase/blob/v5.12.9/src/tools/rcc/main.cpp
https://github.com/qt/qtbase/blob/5.15/src/tools/rcc/main.cpp
The default format version of 5.12 is "2", and in 5.15 it is "3".
According to the source code, version 3 adds Zstd as the new (and default) compression algorithm, while in old version there is only zlib.
From the docs of 5.12 and 5.15:
https://doc.qt.io/archives/qt-5.12/resources.html
https://doc.qt.io/archives/qt-5.12/rcc.html
https://doc.qt.io/qt-5/resources.html
https://doc.qt.io/qt-5/rcc.html
You can see in 5.15 new arguments are added to the rcc tool such as "--compress-algo" and "--format-version".
So from my understanding 5.15 rcc should add--compress-algo zlib --format-version 2?
Not tested though :) If that do not work then maybe they are just incompatible.[Added] found this in https://github.com/qt/qtbase/blob/dev/dist/changes-5.13.0
- RCC now supports compressing content using the Zstandard
(https://zstd.net) algorithm. Compared to zlib, it compresses better for
the same CPU time, so this algorithm is the default. To go back to the
previous algorithm, pass command-line option --compress-algo=zlib.
So this change was added from 5.13
- RCC now supports compressing content using the Zstandard
-
@Robert-Hairgrove I check the Qt source code of the rcc tool, apparently there does have new format from 5.12 to 5.15.
https://github.com/qt/qtbase/blob/v5.12.9/src/tools/rcc/main.cpp
https://github.com/qt/qtbase/blob/5.15/src/tools/rcc/main.cpp
The default format version of 5.12 is "2", and in 5.15 it is "3".
According to the source code, version 3 adds Zstd as the new (and default) compression algorithm, while in old version there is only zlib.
From the docs of 5.12 and 5.15:
https://doc.qt.io/archives/qt-5.12/resources.html
https://doc.qt.io/archives/qt-5.12/rcc.html
https://doc.qt.io/qt-5/resources.html
https://doc.qt.io/qt-5/rcc.html
You can see in 5.15 new arguments are added to the rcc tool such as "--compress-algo" and "--format-version".
So from my understanding 5.15 rcc should add--compress-algo zlib --format-version 2?
Not tested though :) If that do not work then maybe they are just incompatible.[Added] found this in https://github.com/qt/qtbase/blob/dev/dist/changes-5.13.0
- RCC now supports compressing content using the Zstandard
(https://zstd.net) algorithm. Compared to zlib, it compresses better for
the same CPU time, so this algorithm is the default. To go back to the
previous algorithm, pass command-line option --compress-algo=zlib.
So this change was added from 5.13
@Bonnie Thank you very much for your detailed reply. This was very helpful!
- RCC now supports compressing content using the Zstandard
-
R Robert Hairgrove has marked this topic as solved on