Qt-embedded-interest Archive, March 2007
[PATCH] make qt-embedded 3.3.7 compile on arm with gcc 4.0.2
Message 1 in thread
Building qt-embedded on arm failed with gcc 4.0.2 failed with this error:
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2
-D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_QLOCALE_USES_FCVT
-DQT_THREAD_SUPPORT -DQT_NO_CUPS -DQT_NO_NIS -DQT_NO_FREETYPE
-DQT_NO_STYLE_MAC -DQT_NO_STYLE_AQUA -DQT_NO_STYLE_INTERLACE
-DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_COMPACT -DQT_NO_STYLE_POCKETPC
-DQT_NO_QWS_VFB -DQT_NO_QWS_VGA16 -DQT_NO_QWS_TRANSFORMED
-DQT_NO_QWS_SNAP -DQT_NO_QWS_MACH64 -DQT_NO_QWS_VOODOO3
-DQT_NO_QWS_MATROX -DQT_NO_QWS_SHADOWFB -DQT_NO_QWS_REPEATER
-DQT_NO_QWS_KBD_SL5000 -DQT_NO_QWS_KBD_USB -DQT_NO_QWS_KBD_YOPY
-DQT_NO_QWS_KBD_VR41 -DQT_NO_QWS_MOUSE_BUS -DQT_NO_QWS_MOUSE_LINUXTP
-DQT_NO_QWS_MOUSE_VR41 -DQT_NO_QWS_MOUSE_YOPY
-I/home/developer/qt-embedded-free-3.3.7/mkspecs/qws/linux-arm-g++ -I.
-I3rdparty/freetype2/include -I3rdparty/libmng -I3rdparty/libjpeg
-I3rdparty/libpng -I3rdparty/zlib -I../include
-I.moc/release-static-mt-emb-arm/ -o
.obj/release-static-mt-emb-arm/allmoc.o
.moc/release-static-mt-emb-arm/allmoc.cpp
../include/qstring.h: In member function 'ushort& QChar::unicode()':
../include/qstring.h:199: error: cannot bind packed field
'((QChar*)this)->QChar::ucs' to 'ushort&'
This patch fixes this for me.
diff -urN qt-embedded-free-3.3.7.ori/src/tools/qglobal.h
qt-embedded-free-3.3.7/src/tools/qglobal.h
--- qt-embedded-free-3.3.7.ori/src/tools/qglobal.h 2006-10-19
16:25:01.000000000 +0200
+++ qt-embedded-free-3.3.7/src/tools/qglobal.h 2007-03-15
11:02:22.087570384 +0100
@@ -314,12 +314,16 @@
char, or short. We tell gcc to pack QChars to 16 bits, to avoid
QString bloat. However, gcc 3.4 doesn't allow us to create references to
members of a packed struct. (Pointers are OK, because then you
- supposedly know what you are doing.) */
+ supposedly know what you are doing.)
+ For gcc 4.0.2 pointers dont seem to be ok, */
# if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((packed))
# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4
# define Q_NO_PACKED_REFERENCE
# endif
+# if __GNUC__ == 4 && __GNUC_MINOR__ >= 0
+# define Q_NO_PACKED_POINTERS
+# endif
# endif
# if !defined(__EXCEPTIONS)
# define Q_NO_EXCEPTIONS
diff -urN qt-embedded-free-3.3.7.ori/src/tools/qstring.h
qt-embedded-free-3.3.7/src/tools/qstring.h
--- qt-embedded-free-3.3.7.ori/src/tools/qstring.h 2006-10-19
16:25:03.000000000 +0200
+++ qt-embedded-free-3.3.7/src/tools/qstring.h 2007-03-15
11:05:46.890435616 +0100
@@ -195,6 +195,8 @@
ushort unicode() const { return ucs; }
#ifdef Q_NO_PACKED_REFERENCE
ushort &unicode() { return *(&ucs); }
+#elif defined Q_NO_PACKED_POINTERS
+ ushort &unicode() { ushort& tmp = ucs; return tmp; }
#else
ushort &unicode() { return ucs; }
#endif
Comments?
Best regards,
Andre
To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx