Qt5-Maemo5/Development

Building Qt5 for the N900 (using scratchbox)

Prerequisites:


Prepare your build environment:

GITROOT=`pwd`/qt5-maemo5/
USER=YourScratchboxUserName
TARGET=FREMANTLE_ARMEL_GCC472
COMPILER=linaro-4.7-2012.07-fremantle-armv7a
#make some dynamic links realtive
rm /scratchbox/users/${USER}/targets/${TARGET}/usr/lib/libdl.so
ln -s ../../libdl.so.2 /scratchbox/users/${USER}/targets/${TARGET}/usr/lib/libdl.so
rm /scratchbox/users/${USER}/targets/${TARGET}/usr/lib/libm.so
ln -s ../../libm.so.6 /scratchbox/users/${USER}/targets/${TARGET}/usr/lib/libm.so
git clone git://gitorious.org/+qt5-maemo5/qt/qt5-maemo5.git
cd qt5-maemo5 && git remote set-url --push origin git@gitorious.org:+qt5-maemo5/qt
checkout maemo5
git clone git://gitorious.org/+qt5-maemo5/qt/qt5-maemo5-qtbase.git qtbase
git config --add submodule.qtbase.url git://gitorious.org/+qt5-maemo5/qt/qt5-maemo5-qtbase.git
cd qtbase && checkout maemo5 && git remote set-url --push origin git@gitorious.org:+qt5-maemo5/qt/qt5-maemo5-qtbase.git && cd ..
./init-repository -f
#if you like to use the Thumb2 instructions check for -mthumb in QMAKE_CFLAGS
vim qtbase/mkspecs/devices/linux-maemo-n900-g++/qmake.conf


If you like to commit to the repository, create an account on gitorious.org and ask in this thread: http://talk.maemo.org/showthread.php?t=84782


Now it's time to configure:

#-no-c++11 is only needed because of a single bug (related to gcc4.7?)
./configure -no-c++11 -developer-build -opensource -nomake examples -nomake tests -confirm-license -device linux-maemo-n900-g++ -device-option CROSS_COMPILE=/scratchbox/compilers/${COMPILER}/bin/arm-none-linux-gnueabi- -sysroot /scratchbox/users/${USER}/targets/${TARGET}/ -qt-xcb -make libs -prefix /opt/qt5

Finally, we build Qt

make module-qtbase module-qtdeclarative

If you like to compile any Qt program with the newly created Qt build

${GITROOT}/qtbase/bin/qmake
#qmake already knows about sysroot and toolchain as configured above
make
#copy results to N900

Theoretically, you can even install this Qt build in scratchbox (untested):

#only the first step should require root privileges
ln -s  /scratchbox/users/${USER}/targets/${TARGET}/opt/qt5 /opt/qt5
cd ${GITROOT}/qtbase && make install
cd ${GITROOT}/qtdeclarative && make install
cd ${GITROOT}/qtjsbackend && make install
#... (some more as needed by qtdeclarative, e.g. qtsvg)
/scratchbox/login
#change target to the target TARGET
cd /your/qt/program/
/opt/qt5/bin/qmake
make

Building Qt5 for the N900 (using MADDE)

Prerequisites:

If you want to help porting Qt5 to Maemo5 do:

MADDEROOT=/opt/QtSDK/Maemo/4.6.2
git clone git://gitorious.org/+qt5-maemo5/qt/qt5-maemo5.git
cd qt5-maemo5 && git remote set-url --push origin git@gitorious.org:+qt5-maemo5/qt
checkout maemo5
git clone git://gitorious.org/+qt5-maemo5/qt/qt5-maemo5-qtbase.git qtbase
git config --add submodule.qtbase.url git://gitorious.org/+qt5-maemo5/qt/qt5-maemo5-qtbase.git
cd qtbase && checkout maemo5 && git remote set-url --push origin git@gitorious.org:+qt5-maemo5/qt/qt5-maemo5-qtbase.git && cd ..
./init-repository -f
#-sysroots redirects everything to a path under ${MADDEROOT}
ln -s `pwd` ${MADDEROOT}/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim`pwd`
#**Remove** -mthumb in QMAKE_CFLAGS (does not work with current MADDE)
vim qtbase/mkspecs/devices/linux-maemo-n900-g++/qmake.conf

Now it's time to configure:

#change if your host is not x86_64
./configure -developer-build -opensource -nomake examples -nomake tests -no-gtkstyle -confirm-license -device linux-maemo-n900-g++ -device-option CROSS_COMPILE=${MADDEROOT}/toolchains/arm-2007q3-51sb6-gdb71-arm-none-linux-gnueabi_linux_x86_64/bin/arm-none-linux-gnueabi- -sysroot ${MADDEROOT}/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim -qt-xcb -make libs -prefix /opt/qt5

make module-qtbase module-qtdeclarative

If you like to commit to the repository, create an account on gitorious.org and ask in this thread: http://talk.maemo.org/showthread.php?t=84782

Testing Qt5 on the N900

# as root, e.g. with sudo gainroot
#not endless bandwidth, so use with care:
echo "deb http://repos.fuhlbrueck.net/qt5-maemo5 fremantle main" >> /etc/apt/sources.list.d/hildon-application-manager.list
#libX11-xcb1 is not optified, but tiny 
apt-get install libx11-xcb1 qt5-base qt5-declarative
#only for now:
ldconfig /opt/qt5/lib
# as a normal user
# get some example
wget http://repos.fuhlbrueck.net/qt5-maemo5-examples/EXAMPLE
chmod 755 EXAMPLE
./EXAMPLE
#don't be confused, if it shows some debug output
#report any errors to http://talk.maemo.org/showthread.php?t=84782