Kam
Kam

Reputation: 6008

QTcreator cross compiling

I have a project in QtCreator that contains .c and .cpp files and now builds and run fine under my current toolchain GCC.

I want to port this code to run it on arm5 core running linux angstrom distribution.

To do that:

1-I need get QTlibraries built with linux-armv5te-linux-gnueabi-toolchain for example,

2- make a new project in QT and add this version of qt to it.

3- add linux-armv5te-linux-gnueabi-toolchain in the toolchain path of qtcreator so I can build my code with it.

4- when I press build, qmake will generate a makefile that willuse this linux-armv5te-linux-gnueabi-toolchain to compile the .c files with gcc and the .cpp files with g++.

Am I correct with my logic?

Also, how can I perform step1 above?

Thank you

If I download the above toolchain and add it it's bin path to QTcreator, would I be able to build the same project I was discussing above (containing c and cpp files)?

Upvotes: 0

Views: 1791

Answers (1)

Dien Nguyen
Dien Nguyen

Reputation: 2059

I used ARM9 S3C Mini2440. Please download the source code from Qt site and compile it. Below configuration work with Qt4.6

@host:/qt-everywhere-opensource-src-4.6.2#./configure \
-opensource \
-confirm-license \
-release -shared \
-embedded arm \
-xplatform qws/linux-arm-g++ \
-depths 16,18,24 \
-fast \
-optimized-qmake \
-pch \
-qt-sql-sqlite \
-qt-libjpeg \
-qt-zlib \
-qt-libpng \
-qt-freetype \
-little-endian -host-little-endian \
-no-qt3support \
-no-libtiff -no-libmng \
-no-opengl \
-no-mmx -no-sse -no-sse2 \
-no-3dnow \
-no-openssl \
-no-webkit \
-no-qvfb \
-no-phonon \
-no-nis \
-no-opengl \
-no-cups \
-no-glib \
-no-xcursor -no-xfixes -no-xrandr -no-xrender \
-no-separate-debug-info \
-nomake examples -nomake tools -nomake docs \
-qt-mouse-tslib -I/usr/local/tslib/include -L/usr/local/tslib/lib

@host:/qt-everywhere-opensource-src-4.6.2# make
@host:/qt-everywhere-opensource-src-4.6.2# make install

After the install command, you will have ARM Qt4.6 in your /usr/local/Trolltech/QtEmbedded-4.6.2-arm. Create a symblic link to ARM qmake tool

ln -s /usr/local/Trolltech/QtEmbedded-4.6.2-arm/bin/qmake /usr/local/bin/qmake-arm

Create and environment file in order to switch to Qt ARM. Let's call it setenv-qt-arm.sh

export QTEDIR=/usr/local/Trolltech/QtEmbedded-4.6.2-arm
export PATH=/usr/local/Trolltech/QtEmbedded-4.6.2-arm/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.6.2-arm/lib:$LD_LIBRARY_PATH
export CPLUS_INCLUDE_PATH=/usr/local/arm/4.3.2/arm-none-linux-gnueabi/include/c++:/usr/local/arm/4.3.2/arm-none-linux-gnueabi/include/c++/4.3.2/arm-none-linux-gnueabi:$CPLUS_INCLUDE_PATH

In order to cross compile your project

cd /your_project_dir
. /<path_to>/setenv-qt-arm.sh
qmake-arm
make

I did not cross compile Qt project with QtCreator, I used the previous commands instead. If you set your qmake to the correct file (qmake-arm), I think there should be no problem, because this qmake will generate all the Makefile needed to compile your project

Upvotes: 1

Related Questions