ARM Cross Compiler + Qt/Embedded Notes

Host OS: Ubuntu Desktop 7.04
Target OS: Linux ts7200 2.4.26-ts11 #3 Tue Jun 6 14:13:14 MST 2006 armv4l GNU/Linux
Target Hardware: TS-7250 + TS-7KV

The paths used in this document are the defaults produced by following the suggested instructions and letting tar create folders. Where I show patches below, I used them as guides to manually fix the relevent files because I either couldn't find patches for my specific versions and/or I didn't trust my limited knowledge of the automated procedures to use them when appropriate. But they really did work, once the files were changed as the patches indicated.

Packages installed using apt-get:

The crosstool builder needed bison and flex, but they weren't on the Ubuntu Desktop. The Qt/E INSTALL instructions tell one to copy the native uic program from the host to the Qt/E build tree, so I installed qt3-dev-tools to have all of the files the Qt/E builder could possibly need.

Packages manually downloaded and built:

Patches applied to crosstool:

Save the following patch as ~/dev/crosstool-0.43/patches/glibc-2.3.2/glibc-2.3.2-csu-Makefile.patch

--- glibc-2.3.2/csu/Makefile 2002-12-31 23:24:37.000000000 +0100
+++ 2007-08-15 08:36:44.000000000 +0200
@@ -222,13 +222,13 @@ $(objpfx)version-info.h: $(common-objpfx
if [ -z "$$os" ]; then \
os=Linux; \
fi; \
- echo "\"Compiled on a $$os $$version system" \
- "on `date +%Y-%m-%d`.\\n\"" ;; \
+ printf '"Compiled on a %s %s system on %s.\\n"\n' \
+ "$$os" "$$version" "`date +%Y-%m-%d`";; \
*) ;; \
esac; \
files="$(all-Banner-files)"; \
if test -n "$$files"; then \
- echo "\"Available extensions:\\n\""; \
+ printf '"Available extensions:\\n"'; \
sed -e '/^#/d' -e 's/^[[:space:]]*/ /' \
-e 's/\(^.*$$\)/\"\1\\n\"/' $$files; \
fi) > $@T

If everything goes as expected, the crosstool build process will automatically apply this patch. However, I applied the patch manually to both the Makefile and the version-info.h file that it wrote after it failed to compile for me, so I'm not sure if the automatic patch will work or not.

Patches applied to Qt/E sources:

In the Qt/E make specs:

In the mkspecs/qws/linux-arm-g++/qmake.conf file I changed the gcc and g++ entries to $(CROSS_PATH)/gcc and $(CROSS_PATH)/g++ and before running Qt/E's make command, I also executed this command (to set the CROSS_PATH environment variable):

export CROSS_PATH=/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/arm-unknown-linux-gnu/bin  

In the Qt/E sources:

The src/tools/qglobal.h and src/tools/qstring.h files need to be changed as described in the following diff patches:

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 I seem to be not 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; }
     ushort &unicode() { return *(&ucs); }
+#elif defined Q_NO_PACKED_POINTERS
+    ushort &unicode() { ushort& tmp = ucs; return tmp; }
     ushort &unicode() { return ucs; }

Procedures followed to build crosstool:

See the crosstool-howto at

Procedure followed for Qt/E:

I followed the directions in the INSTALL file, with a small addition due to my patch (see above). I copied the uic program that was installed with qt3-dev-tools into the qtembedded-free-3.3.4/bin directory and ran these commands:

./configure -embedded arm
export CROSS_PATH=/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/arm-unknown-linux-gnu/bin

What's needed to create custom Qt/E projects using the cross compiler?

This is the next step in my research. So far, it appears to be what I tend to think of as "magic" because I've only built pre-packages source kits that have special command-line and configuration files for supporting the cross compiler. Hopefully, I'll stumble over some documentation about actually using the crosstool chain, maybe even something that shows me how to create and build a basic Qt/E project using the crosstool chain.

More to come...