I'm working with an software using qt3. It works fine un x86-linux systems. When i tried to port it to Raspberry Pi 2 i got a weird compiler error. Google wasn't able to help me and everything i tried failed.
The error is:
cannot bind packed field '((QChar*)this)->QChar::ucs' to 'ushort&{aka short unsigned int&}'
which is refering to the following part of qstring.h
class Q_EXPORT QChar {
...
#ifdef Q_NO_PACKED_REFERENCE
ushort &unicode() { return *(&ucs); }
#else
ushort &unicode() { return ucs; } // Throws error
#endif
...
}
Of course i already tried to define Q_NO_PACKED_REFERENCE
which just moves the error to the line above. I also tried to explicitely define the architecture, float abi and cpu.
Here is my environment:
- CPU: ARMv7
- OS: Ubuntu 16.04
- Compiler: gcc/g++ 4.8.5 (Ubuntu/Linaro 4.8.5-4ubuntu2)
- Qt Version: 3.3.8b from here (tried with x11 and embedded)
If you wonder why i use qt3 and an old gcc, it's because we want to keep our source code compatible with some older systems we have in use.
My question is: What is the reason for this error and how can i fix it? (Preferably fixing without changing the qt3 header files.)
That error is weird. The solution i found is even weirder.
It seems the qt3 installations from https://download.qt.io/archive/qt/3/ contain different header files than the debian packages from https://launchpad.net/ubuntu/precise/armhf.
After installing qt3 from the debian packages instead of compiling the source from the qt page my code compiled fine.
I looked at both header files and the line causing the error now contains an additional cast.
From qt.io
From launchpad
There seem to be even more differences between both sets of headers. If someone else has any problems regarding qt header files it also might be to these differences.