16.03.2015 Views

Setting up cross compiling environment & Qt/X11 ... - Bytemark Hosting

Setting up cross compiling environment & Qt/X11 ... - Bytemark Hosting

Setting up cross compiling environment & Qt/X11 ... - Bytemark Hosting

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

You will have to log out and log in again for changes to take effect.<br />

6.2 Using <strong>Qt</strong><br />

There are tree different ways of using <strong>Qt</strong> for compilation. You can simply use the terminal to<br />

compile your <strong>Qt</strong> code, you can use the <strong>Qt</strong>Creator or you can use Eclipse. For the <strong>Qt</strong>Creator there<br />

are two guides, depending on which version of <strong>Qt</strong>Creator you are using. It is recommended to use<br />

version 2 of <strong>Qt</strong>Creator because it is much easier to set <strong>up</strong> <strong>cross</strong> <strong>compiling</strong>.<br />

6.2.1 Using <strong>Qt</strong> in the Terminal<br />

To use <strong>Qt</strong> in the terminal you simply need to go into the folder where your sources are and run<br />

$ qmake ­project<br />

to create the .pro file. This is required only once for each project but it needs to be done again when<br />

you add source files. After that you can create a make file by invoking<br />

$ qmake<br />

<strong>Qt</strong> will take care of <strong>cross</strong> compilation and you just have to run<br />

$ make<br />

to compile the project.<br />

6.2.2 Installing <strong>Qt</strong>Creator<br />

Install the normal <strong>Qt</strong>Creator for X86 on your desktop machine. You do not need to install the whole<br />

<strong>Qt</strong> libraries, only what is required for the <strong>Qt</strong>Creator itself. To install <strong>Qt</strong>Creator on a Debian based<br />

system (like Ubuntu) type this in a terminal:<br />

$ sudo apt­get install qtcreator<br />

If you also want to install <strong>Qt</strong> for a local compilation invoke this command:<br />

$ sudo apt­get install libqt4­dev<br />

6.2.3 Using <strong>Qt</strong> with <strong>Qt</strong>Creator 1.x.x<br />

Start your <strong>Qt</strong>Creator and create a simple project.<br />

Now go to Tools → Options → Debugger → Gdb and select the ARM <strong>cross</strong> gdb:<br />

/opt/eldk­5.2.1/armv7a/sysroots/i686­eldk­linux/usr/bin/armv7a­vfp­neonlinux­gnueabi/arm­linux­gnueabi­gdb<br />

On the left side go to <strong>Qt</strong>4 → <strong>Qt</strong> Versions and add a new <strong>Qt</strong> version to Manual. Call it something<br />

like <strong>Qt</strong> 4.8.2 for ARM and add the qmake executable:<br />

/usr/local/Trolltech/<strong>Qt</strong>­arm­<strong>X11</strong>/bin/qmake<br />

Now the <strong>Qt</strong>Creator is ready for <strong>cross</strong> <strong>compiling</strong>. There is one issue with the ELDK which causes g+<br />

+ to complain about this:<br />

note: the mangling of 'va_list' has changed in GCC 4.4<br />

This is a known issue and can be ignored. To tell GCC to s<strong>up</strong>press this message you can pass the<br />

argument -Wno-psabi to it. To do this in a <strong>Qt</strong> project add the following line at the end of your .pro<br />

file:<br />

14/20

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!