Raspberrypi beginners guide: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
h1. Beginner's guide to cross-compile Qt5 on RaspberryPi | h1. Beginner's guide to cross-compile Qt5 on RaspberryPi | ||
[toc align_right= | [toc align_right="yes" depth="2"] | ||
== Introduction == | == Introduction == | ||
This is a step by step guide to help beginners to: cross-compile QT5 for RaspberryPi(wheezy), create, deploy and run an example project. This article will focus on simplicity, so if you are looking for additional customization, please check a more | This is a step by step guide to help beginners to: cross-compile QT5 for RaspberryPi(wheezy), create, deploy and run an example project. This article will focus on simplicity, so if you are looking for additional customization, please check a more "detailed guide":http://wiki.qt.io/RaspberryPi. | ||
For an easy install, try | For an easy install, try "this script.":https://gist.github.com/raw/3488286/d1d301946297be999d96df632a0ad0095a4d77e7/bakeqtpi.bash<br />Or get a later version "here":http://gitorious.org/bakeqtpi<br />For help, run | ||
<code> $ ./bakeqtpi.bash —help<code> | <code> $ ./bakeqtpi.bash —help<code> | ||
Line 13: | Line 13: | ||
== Getting Started == | == Getting Started == | ||
First we create a folder to hold the source code and all the required files to do the cross-compilation. We chose to create a directory named | First we create a folder to hold the source code and all the required files to do the cross-compilation. We chose to create a directory named "opt" in the home folder:<br /></code>paulo</code>westeros:~$ mkdir~/opt<br />paulo<code>westeros:~$ cd~/opt<code> | ||
Now, download the following files:<br />* Raspbian Wheezy image from ( | Now, download the following files:<br />* Raspbian Wheezy image from ("here":http://www.raspberrypi.org/downloads):<br /></code>paulo</code>westeros:~/opt$ wget http://downloads.raspberrypi.org/raspbian_latest/ -O wheezy-raspbian-latest.zip<br />paulo<code>westeros:~/opt$ unzip wheezy-raspbian-latest.zip<code><br />And mount it:<br /></code>paulo</code>westeros:~/opt$ sudo mkdir /mnt/rasp-pi-rootfs<br />paulo<code>westeros:~/opt$ sudo mount -o loop,offset=62914560 2015-02-16-raspbian-wheezy.img /mnt/rasp-pi-rootfs<code> | ||
* The toolchain built by Donald: (Note, seems to be dead links!)<br /></code>paulo</code>westeros: | * The toolchain built by Donald: (Note, seems to be dead links!)<br /></code>paulo</code>westeros:~/opt$ wget https://www.dropbox.com/s/sl919ly0q79m1e6/gcc-4.7-linaro-rpi-gnueabihf.tbz<br />(or a mirror at http://swap.tsmt.eu/gcc-4.7-linaro-rpi-gnueabihf.tbz with sha1 f6255c6aca925239dc943d22a794f642daa17e65)<br />(or better at http://de.sourceforge.jp/projects/sfnet_rfidmonitor/downloads/crosscompilation-resources/gcc-4.7-linaro-rpi-gnueabihf.tbz<br />as the above noted links seem to be broken)<br />paulo<code>westeros:~/opt$ tar -xf gcc-4.7-linaro-rpi-gnueabihf.tbz<code><br />Pro tip: don't build your own cross-compiler. You'll overlook something important and loose a couple of hours of your life for nothing. A suitable Raspberry Pi cross-compiler is also available here: https://github.com/raspberrypi/tools | ||
It is a 32-bit build so if you are running on a 64-bit machine (you probably are) you need to install ia32-libs:<br /></code>paulo</code>westeros: | It is a 32-bit build so if you are running on a 64-bit machine (you probably are) you need to install ia32-libs:<br /></code>paulo</code>westeros:~/opt$ sudo apt-get install ia32-libs</code> | ||
<br />* Clone the cross-compile-tools repository:<br /><code>paulo<code>westeros: | <br />* Clone the cross-compile-tools repository:<br /><code>paulo<code>westeros:~/opt$ git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git<code> | ||
* Clone and init the Qt5 repository:<br /></code>paulo</code>westeros: | * Clone and init the Qt5 repository:<br /></code>paulo</code>westeros:~/opt$ git clone git://gitorious.org/qt/qt5.git<br />paulo<code>westeros:~/opt$ cd qt5<br />paulo</code>westeros:~/opt/qt5$ ./init-repository</code><br />If you're behind a firewall ./init-repository might fail. First run this command:<br /><code>paulo<code>westeros:~/opt/qt5$ sed -i 's/git:/https:git./' .gitmodules<code><br />Then retry:<br /></code>paulo</code>westeros:~/opt/qt5$ ./init-repository -f</code> | ||
<br />* Finally, apply a patch on the qtjsbackend repository:<br /><code>paulo<code>wseteros: | <br />* Finally, apply a patch on the qtjsbackend repository:<br /><code>paulo<code>wseteros:~/opt/qt5$ cd ~/opt/qt5/qtjsbackend<br />paulo</code>wseteros:~/opt/qt5/qtjsbackend$ git fetch https://codereview.qt.io/p/qt/qtjsbackend refs/changes/56/27256/4 && git cherry-pick FETCH_HEAD</code> | ||
<br />h2. Compiling qtbase | <br />h2. Compiling qtbase | ||
<br />Now the we have all the resources needed to compile qt5 for raspberry, we need to execute a script to fix symlinks and lib paths: | <br />Now the we have all the resources needed to compile qt5 for raspberry, we need to execute a script to fix symlinks and lib paths: | ||
<br /><code>paulo<code>westeros: | <br /><code>paulo<code>westeros:~$ cd~/opt/cross-compile-tools<br />paulo</code>westeros:~$ sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc</code> | ||
<br />Go to the qt5/qtbase folder and run:<br /><code>paulo<code>westeros: | <br />Go to the qt5/qtbase folder and run:<br /><code>paulo<code>westeros:~/opt/qt5/qtbase$ ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi<br />paulo</code>westeros:~/opt/qt5/qtbase$ make -j 4<br />paulo<code>westeros:~/opt/qt5/qtbase$ sudo make install<code><br />Note: if you want the qmlscene binary you should add -make tools to the ./configure command. | ||
== Compiling other modules == | == Compiling other modules == | ||
Line 33: | Line 33: | ||
Now that you have qmake, you can cross-compile the other modules. To avoid dependencies errors, the following order is sugested:<br />qtimageformats, qtsvg, qtjsbackend, qtscript, qtxmlpatterns, qtdeclarative, qtsensors, qt3d, qtgraphicaleffects, qtjsondb, qtlocation, qtdocgallery. | Now that you have qmake, you can cross-compile the other modules. To avoid dependencies errors, the following order is sugested:<br />qtimageformats, qtsvg, qtjsbackend, qtscript, qtxmlpatterns, qtdeclarative, qtsensors, qt3d, qtgraphicaleffects, qtjsondb, qtlocation, qtdocgallery. | ||
To compile, you must do like the example below:<br /></code>paulo</code>westeros: | To compile, you must do like the example below:<br /></code>paulo</code>westeros:~/opt/qt5$ cd qtimageformats<br />paulo<code>westeros:~/opt/qt5/qtimageformats$ /usr/local/qt5pi/bin/qmake .<br />paulo</code>westeros:~/opt/qt5/qtimageformats$ make -j4<br />paulo<code>westeros:~/opt/qt5/qtimageformats$ sudo make install<code> | ||
We have all the modules installed in the wheezy image, now we can copy it to the sdcard using dd:<br /></code>paulo</code>westeros: | We have all the modules installed in the wheezy image, now we can copy it to the sdcard using dd:<br /></code>paulo</code>westeros:~/opt/qt5$ cd~/opt/<br />paulo<code>westeros:~/opt$ sync; sudo umount /mnt/rasp-pi-rootfs<br />paulo</code>westeros:~/opt$ sudo dd bs=1M if=2012-07-15-wheezy-raspbian.img of=/dev/sdb; sync<br /><code> | ||
obs: Check the entry point of your sdcard. Mine was /dev/sdb. | obs: Check the entry point of your sdcard. Mine was /dev/sdb. | ||
Line 43: | Line 43: | ||
* Because your sdcard will be partitioned, OSX won't let you umount it, so you'll need to type:<br /></code>sudo diskutil umountDisk /dev/disk3</code> | * Because your sdcard will be partitioned, OSX won't let you umount it, so you'll need to type:<br /></code>sudo diskutil umountDisk /dev/disk3</code> | ||
where | where "disk3" will be the /dev/diskXsY where your sdcard first appeared. | ||
* To perform dd you will need to use the *r*disk index, so if your sdcard is disk3 you will need to type:<br /><code>sudo dd bs=1M if=2012-07-15-wheezy-raspbian.img of=/dev/rdisk3; sync<code> | * To perform dd you will need to use the *r*disk index, so if your sdcard is disk3 you will need to type:<br /><code>sudo dd bs=1M if=2012-07-15-wheezy-raspbian.img of=/dev/rdisk3; sync<code> | ||
Line 51: | Line 51: | ||
== Configuring Qt Creator == | == Configuring Qt Creator == | ||
To use Qt Creator properly, you must configure the | To use Qt Creator properly, you must configure the "Qt Version" and "Tool Chains" sections. | ||
=== Tool Chain Settings === | === Tool Chain Settings === | ||
go to '''Tools | go to '''Tools -> Options..-> Build & Run -> Compilers''' tab.<br />click in "'''Add -> GCC'''".<br />On "'''Compiler Path'''" set to "/home/<you>/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g+''".<br />Name it "ARM GCC" or similar.<br />obs: Adjust it to your username. | ||
<br />h3. Qt Version settings. | <br />h3. Qt Version settings. | ||
<br />Now go to '''Tools | <br />Now go to '''Tools -> Options..-> Build & Run -> Qt Versions''' tab.<br />Click in "Add.." and choose you qmake for raspberry "/usr/local/qt5pi/bin/qmake". | ||
<br />'''Note for OSX'''<br />* Because /usr is not visible by default, you first need to open a terminal and type:<br /></code>sudo SetFile -a v /usr</code><br />* After you've completed the qmake selection, if you wish to make /usr invisible again, type the same command with a capital V :<br /><code>sudo SetFile -a V /usr<code> | <br />'''Note for OSX'''<br />* Because /usr is not visible by default, you first need to open a terminal and type:<br /></code>sudo SetFile -a v /usr</code><br />* After you've completed the qmake selection, if you wish to make /usr invisible again, type the same command with a capital V :<br /><code>sudo SetFile -a V /usr<code> | ||
<br />h3. Configure Linux Devices | <br />h3. Configure Linux Devices | ||
<br />Go to '''Tools | <br />Go to '''Tools -> Options…-> Devices -> Devices''' tab. | ||
<br />Add a new configuration setting a | <br />Add a new configuration setting a "Generic Linux Device"<br />Hostname or IP address is the IP of your raspberry<br />user is '''pi'''<br />password is '''raspberry'''<br />obs: if your not did change it. | ||
<br />Now you are ready to run your first Qt raspberry pi project. | <br />Now you are ready to run your first Qt raspberry pi project. | ||
<br />h2. Example Project | <br />h2. Example Project | ||
<br />You can download a hello world project:<br /></code>paulo</code>westeros: | <br />You can download a hello world project:<br /></code>paulo</code>westeros:~$ git clone https://git.gitorious.org/qt5-raspberrypi-example/qt5-raspberrypi-example.git</code> | ||
<br />Open the project in Qt Creator and go to the Projects pane.<br />Click Manage Kits and then Add.<br />Fill in:<br />Name: Raspberry Pi<br />Device Type: Generic Linux Device<br />Device: Raspberry Pi<br />Compiler: ARM GCC<br />Debugger- | <br />Open the project in Qt Creator and go to the Projects pane.<br />Click Manage Kits and then Add.<br />Fill in:<br />Name: Raspberry Pi<br />Device Type: Generic Linux Device<br />Device: Raspberry Pi<br />Compiler: ARM GCC<br />Debugger->Manage->Edit->"/home/<you>/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gdb" (change your username)<br />Qt version: Qt 5.x.x (qt5pi)<br />Ok->Add Kit->Raspberry Pi | ||
<br />Then go to the | <br />Then go to the "Rasperry Pi" kit tab->System Environment and add LD_LIBRARY_PATH which is set to /usr/local/qt5pi/lib | ||
<br />Now you can build and run your application from Qt Creator. | <br />Now you can build and run your application from Qt Creator. | ||
<br />h2. Troubleshooting | <br />h2. Troubleshooting | ||
Line 76: | Line 76: | ||
<br />h3. The default mkspec symlink is broken. | <br />h3. The default mkspec symlink is broken. | ||
<br />It means that mkspec is not found on your sysroot, so your must copy it. | <br />It means that mkspec is not found on your sysroot, so your must copy it. | ||
<br /></code>paulo</code>westeros: | <br /></code>paulo</code>westeros:~$ sudo cp -r /usr/local/qt5pi/mkspecs/ /mnt/rasp-pi-rootfs/usr/local/qt5pi/</code> | ||
<br />If the problem persists, create the missing symlink, e.g. | <br />If the problem persists, create the missing symlink, e.g. | ||
<br /><code>sudo ln -s /usr/local/qt5pi/mkspecs/devices/linux-rasp-pi-g''+ /usr/local/qt5pi/mkspecs/default<code> | <br /><code>sudo ln -s /usr/local/qt5pi/mkspecs/devices/linux-rasp-pi-g''+ /usr/local/qt5pi/mkspecs/default<code> | ||
Line 82: | Line 82: | ||
It is probably a good idea to do the same for the sysroot mkspecs. | It is probably a good idea to do the same for the sysroot mkspecs. | ||
=== Include | === Include <QtGui/QtGui>: No such file or directory === | ||
It seems Qt's include was not found and you must add it to you .pro file: | It seems Qt's include was not found and you must add it to you .pro file: | ||
Line 88: | Line 88: | ||
</code>INCLUDEPATH ''= /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/</code> | </code>INCLUDEPATH ''= /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/</code> | ||
<br />h3. cc1: fatal error: .pch/release-shared/QtGui: No such file or directory | <br />h3. cc1: fatal error: .pch/release-shared/QtGui: No such file or directory | ||
<br />Some people have seen this error. Adding the | <br />Some people have seen this error. Adding the "-no-pch" option when running configure should prevent it. | ||
<br />h3. Getting Could not determine the target architecture! and Could not determine the host architecture! | <br />h3. Getting Could not determine the target architecture! and Could not determine the host architecture! | ||
<br />If you are getting this kind of error, it is possible that your current git branch is something other than master. To be sure, do the following: | <br />If you are getting this kind of error, it is possible that your current git branch is something other than master. To be sure, do the following: | ||
<br /><code>daniel<code>daniel-t3500 : | <br /><code>daniel<code>daniel-t3500 : ~/opt/qt5/qtbase $ git branch <code> | ||
<br />If it shows like this:<br /></code>* (no branch)<br /> master<code> | <br />If it shows like this:<br /></code>* (no branch)<br /> master<code> | ||
<br />Then you must checkout to master branch before running ./configure:<br /></code>daniel</code>daniel-t3500 : | <br />Then you must checkout to master branch before running ./configure:<br /></code>daniel</code>daniel-t3500 :~/opt/qt5/qtbase $ git checkout master<br />daniel<code>daniel-t3500 : ~/opt/qt5/qtbase $ git branch<br />* master</code> | ||
<br />It is also good to fetch the latest commits and apply them by doing:<br /><code>daniel<code>daniel-t3500 : | <br />It is also good to fetch the latest commits and apply them by doing:<br /><code>daniel<code>daniel-t3500 :~/opt/qt5/qtbase $ git pull<code> | ||
<br />Also, check for the installation of libz (32 bits) in yor system. In ubuntu (64 bits) you might just:<br /></code>sudo apt-get install lib32z1-dev</code> | <br />Also, check for the installation of libz (32 bits) in yor system. In ubuntu (64 bits) you might just:<br /></code>sudo apt-get install lib32z1-dev</code> | ||
<br />After the ./configure script has failed first run these commands before restarting ./configure: | <br />After the ./configure script has failed first run these commands before restarting ./configure: | ||
<br /><code>daniel<code>daniel-t3500 : | <br /><code>daniel<code>daniel-t3500 : ~/opt/qt5/qtbase $ git reset —hard<br />daniel</code>daniel-t3500 :~/opt/qt5/qtbase $ git git clean -dxf</code> | ||
<br />h3. EGL Error : Could not create the egl surface: error = 0x3000 | <br />h3. EGL Error : Could not create the egl surface: error = 0x3000 | ||
<br />Try allocating more memory to video (try 64 or 128MB). Use the raspi-config utility to change this. | <br />Try allocating more memory to video (try 64 or 128MB). Use the raspi-config utility to change this. | ||
Line 103: | Line 103: | ||
<br />h3. ABI detection failed | <br />h3. ABI detection failed | ||
<br />You will need Qt Creator 2.6 for Qt5 up to and including beta2.<br />Any Qt 5 later than that will need to use nightly snapshots (or will have to wait for Qt Creator 2.6.1): After the beta2 all libraries were renamed again. | <br />You will need Qt Creator 2.6 for Qt5 up to and including beta2.<br />Any Qt 5 later than that will need to use nightly snapshots (or will have to wait for Qt Creator 2.6.1): After the beta2 all libraries were renamed again. | ||
<br />See | <br />See "this forum thread for more details":http://forum.qt.io/viewthread/22023 | ||
<br />h3. ./configure: 2654: ./configure: /home/ | <br />h3. ./configure: 2654: ./configure: /home/<you>/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g: not found -reduce-exports was requested but this compiler does not support it | ||
<br />The error message is totally misleading. The real cause is that the precompile toolchain is 32-bit, so you need to:<br /></code>sudo apt-get install ia32-libs</code> | <br />The error message is totally misleading. The real cause is that the precompile toolchain is 32-bit, so you need to:<br /></code>sudo apt-get install ia32-libs</code> | ||
<br />h3. make: g: Command not found | <br />h3. make: g: Command not found |
Revision as of 14:23, 24 February 2015
h1. Beginner's guide to cross-compile Qt5 on RaspberryPi
[toc align_right="yes" depth="2"]
Introduction
This is a step by step guide to help beginners to: cross-compile QT5 for RaspberryPi(wheezy), create, deploy and run an example project. This article will focus on simplicity, so if you are looking for additional customization, please check a more "detailed guide":http://wiki.qt.io/RaspberryPi.
For an easy install, try "this script.":https://gist.github.com/raw/3488286/d1d301946297be999d96df632a0ad0095a4d77e7/bakeqtpi.bash
Or get a later version "here":http://gitorious.org/bakeqtpi
For help, run
$ ./bakeqtpi.bash —help<code>
== Getting Started ==
First we create a folder to hold the source code and all the required files to do the cross-compilation. We chose to create a directory named "opt" in the home folder:<br />
paulowesteros:~$ mkdir~/opt
paulo
westeros:~$ cd~/opt<code>
Now, download the following files:<br />* Raspbian Wheezy image from ("here":http://www.raspberrypi.org/downloads):<br />
paulowesteros:~/opt$ wget http://downloads.raspberrypi.org/raspbian_latest/ -O wheezy-raspbian-latest.zip
paulo
westeros:~/opt$ unzip wheezy-raspbian-latest.zip<code><br />And mount it:<br />
paulowesteros:~/opt$ sudo mkdir /mnt/rasp-pi-rootfs
paulo
westeros:~/opt$ sudo mount -o loop,offset=62914560 2015-02-16-raspbian-wheezy.img /mnt/rasp-pi-rootfs<code>
* The toolchain built by Donald: (Note, seems to be dead links!)<br />
paulowesteros:~/opt$ wget https://www.dropbox.com/s/sl919ly0q79m1e6/gcc-4.7-linaro-rpi-gnueabihf.tbz
(or a mirror at http://swap.tsmt.eu/gcc-4.7-linaro-rpi-gnueabihf.tbz with sha1 f6255c6aca925239dc943d22a794f642daa17e65)
(or better at http://de.sourceforge.jp/projects/sfnet_rfidmonitor/downloads/crosscompilation-resources/gcc-4.7-linaro-rpi-gnueabihf.tbz
as the above noted links seem to be broken)
paulo
westeros:~/opt$ tar -xf gcc-4.7-linaro-rpi-gnueabihf.tbz<code><br />Pro tip: don't build your own cross-compiler. You'll overlook something important and loose a couple of hours of your life for nothing. A suitable Raspberry Pi cross-compiler is also available here: https://github.com/raspberrypi/tools
It is a 32-bit build so if you are running on a 64-bit machine (you probably are) you need to install ia32-libs:<br />
paulowesteros:~/opt$ sudo apt-get install ia32-libs
* Clone the cross-compile-tools repository:
paulo<code>westeros:~/opt$ git clone git://gitorious.org/cross-compile-tools/cross-compile-tools.git<code>
* Clone and init the Qt5 repository:<br />
paulowesteros:~/opt$ git clone git://gitorious.org/qt/qt5.git
paulo
westeros:~/opt$ cd qt5<br />paulo
westeros:~/opt/qt5$ ./init-repository
If you're behind a firewall ./init-repository might fail. First run this command:
paulo<code>westeros:~/opt/qt5$ sed -i 's/git:/https:git./' .gitmodules<code><br />Then retry:<br />
paulowesteros:~/opt/qt5$ ./init-repository -f
* Finally, apply a patch on the qtjsbackend repository:
paulo<code>wseteros:~/opt/qt5$ cd ~/opt/qt5/qtjsbackend<br />paulo
wseteros:~/opt/qt5/qtjsbackend$ git fetch https://codereview.qt.io/p/qt/qtjsbackend refs/changes/56/27256/4 && git cherry-pick FETCH_HEAD
h2. Compiling qtbase
Now the we have all the resources needed to compile qt5 for raspberry, we need to execute a script to fix symlinks and lib paths:
paulo<code>westeros:~$ cd~/opt/cross-compile-tools<br />paulo
westeros:~$ sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
Go to the qt5/qtbase folder and run:
paulo<code>westeros:~/opt/qt5/qtbase$ ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi<br />paulo
westeros:~/opt/qt5/qtbase$ make -j 4
paulo
westeros:~/opt/qt5/qtbase$ sudo make install<code><br />Note: if you want the qmlscene binary you should add -make tools to the ./configure command.
== Compiling other modules ==
Now that you have qmake, you can cross-compile the other modules. To avoid dependencies errors, the following order is sugested:<br />qtimageformats, qtsvg, qtjsbackend, qtscript, qtxmlpatterns, qtdeclarative, qtsensors, qt3d, qtgraphicaleffects, qtjsondb, qtlocation, qtdocgallery.
To compile, you must do like the example below:<br />
paulowesteros:~/opt/qt5$ cd qtimageformats
paulo
westeros:~/opt/qt5/qtimageformats$ /usr/local/qt5pi/bin/qmake .<br />paulo
westeros:~/opt/qt5/qtimageformats$ make -j4
paulo
westeros:~/opt/qt5/qtimageformats$ sudo make install<code>
We have all the modules installed in the wheezy image, now we can copy it to the sdcard using dd:<br />
paulowesteros:~/opt/qt5$ cd~/opt/
paulo
westeros:~/opt$ sync; sudo umount /mnt/rasp-pi-rootfs<br />paulo
westeros:~/opt$ sudo dd bs=1M if=2012-07-15-wheezy-raspbian.img of=/dev/sdb; sync
obs: Check the entry point of your sdcard. Mine was /dev/sdb.
'''Notes for OSX'''
* Because your sdcard will be partitioned, OSX won't let you umount it, so you'll need to type:<br />
sudo diskutil umountDisk /dev/disk3
where "disk3" will be the /dev/diskXsY where your sdcard first appeared.
- To perform dd you will need to use the *r*disk index, so if your sdcard is disk3 you will need to type:sudo SetFile -a v /usr
sudo dd bs=1M if=2012-07-15-wheezy-raspbian.img of=/dev/rdisk3; sync<code> Boot up your pi. == Configuring Qt Creator == To use Qt Creator properly, you must configure the "Qt Version" and "Tool Chains" sections. === Tool Chain Settings === go to '''Tools -> Options..-> Build & Run -> Compilers''' tab.<br />click in "'''Add -> GCC'''".<br />On "'''Compiler Path'''" set to "/home/<you>/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g+''".<br />Name it "ARM GCC" or similar.<br />obs: Adjust it to your username. <br />h3. Qt Version settings. <br />Now go to '''Tools -> Options..-> Build & Run -> Qt Versions''' tab.<br />Click in "Add.." and choose you qmake for raspberry "/usr/local/qt5pi/bin/qmake". <br />'''Note for OSX'''<br />* Because /usr is not visible by default, you first need to open a terminal and type:<br />
* After you've completed the qmake selection, if you wish to make /usr invisible again, type the same command with a capital V :paulowesteros:~$ git clone https://git.gitorious.org/qt5-raspberrypi-example/qt5-raspberrypi-example.gitsudo SetFile -a V /usr<code> <br />h3. Configure Linux Devices <br />Go to '''Tools -> Options…-> Devices -> Devices''' tab. <br />Add a new configuration setting a "Generic Linux Device"<br />Hostname or IP address is the IP of your raspberry<br />user is '''pi'''<br />password is '''raspberry'''<br />obs: if your not did change it. <br />Now you are ready to run your first Qt raspberry pi project. <br />h2. Example Project <br />You can download a hello world project:<br />
Open the project in Qt Creator and go to the Projects pane.
Click Manage Kits and then Add.
Fill in:
Name: Raspberry Pi
Device Type: Generic Linux Device
Device: Raspberry Pi
Compiler: ARM GCC
Debugger->Manage->Edit->"/home/<you>/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gdb" (change your username)
Qt version: Qt 5.x.x (qt5pi)
Ok->Add Kit->Raspberry Pi
Then go to the "Rasperry Pi" kit tab->System Environment and add LD_LIBRARY_PATH which is set to /usr/local/qt5pi/lib
Now you can build and run your application from Qt Creator.
h2. Troubleshooting
h3. Qt version not properly installed
You need to keep the SD card image mounted during development!
If QtCreator still reports this after mounting the SD card image, then you may need to create the directories missing from
/mnt/rasp-pi-rootfs/usr/local/qt5pi/<code>
<br />or whatever the mount path is (these will probably include bin, translations, and so on). You can create empty directories using the mkdir command.
<br />h3. The default mkspec symlink is broken.
<br />It means that mkspec is not found on your sysroot, so your must copy it.
<br />
paulowesteros:~$ sudo cp -r /usr/local/qt5pi/mkspecs/ /mnt/rasp-pi-rootfs/usr/local/qt5pi/
If the problem persists, create the missing symlink, e.g.
sudo ln -s /usr/local/qt5pi/mkspecs/devices/linux-rasp-pi-g''+ /usr/local/qt5pi/mkspecs/default<code>
It is probably a good idea to do the same for the sysroot mkspecs.
=== Include <QtGui/QtGui>: No such file or directory ===
It seems Qt's include was not found and you must add it to you .pro file:
INCLUDEPATH = /mnt/rasp-pi-rootfs/usr/local/qt5pi/include/
h3. cc1: fatal error: .pch/release-shared/QtGui: No such file or directory
Some people have seen this error. Adding the "-no-pch" option when running configure should prevent it.
h3. Getting Could not determine the target architecture! and Could not determine the host architecture!
If you are getting this kind of error, it is possible that your current git branch is something other than master. To be sure, do the following:
daniel<code>daniel-t3500 : ~/opt/qt5/qtbase $ git branch <code>
<br />If it shows like this:<br />
* (no branch)
master
<br />Then you must checkout to master branch before running ./configure:<br />
danieldaniel-t3500 :~/opt/qt5/qtbase $ git checkout master
daniel
daniel-t3500 : ~/opt/qt5/qtbase $ git branch<br />* master
It is also good to fetch the latest commits and apply them by doing:
daniel<code>daniel-t3500 :~/opt/qt5/qtbase $ git pull<code>
<br />Also, check for the installation of libz (32 bits) in yor system. In ubuntu (64 bits) you might just:<br />
sudo apt-get install lib32z1-dev
After the ./configure script has failed first run these commands before restarting ./configure:
daniel<code>daniel-t3500 : ~/opt/qt5/qtbase $ git reset —hard<br />daniel
daniel-t3500 :~/opt/qt5/qtbase $ git git clean -dxf
h3. EGL Error : Could not create the egl surface: error = 0x3000
Try allocating more memory to video (try 64 or 128MB). Use the raspi-config utility to change this.
pi<code>raspberrypi ~ $ sudo raspi-config<code>
<br />h3. ABI detection failed
<br />You will need Qt Creator 2.6 for Qt5 up to and including beta2.<br />Any Qt 5 later than that will need to use nightly snapshots (or will have to wait for Qt Creator 2.6.1): After the beta2 all libraries were renamed again.
<br />See "this forum thread for more details":http://forum.qt.io/viewthread/22023
<br />h3. ./configure: 2654: ./configure: /home/<you>/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g: not found -reduce-exports was requested but this compiler does not support it
<br />The error message is totally misleading. The real cause is that the precompile toolchain is 32-bit, so you need to:<br />
sudo apt-get install ia32-libs
h3. make: g: Command not found
Qt requires a native (non-cross-compiling) copy of g+ to be installed in order to build qmake. You can't use clang. Fix with:
sudo apt-get install g++<code>
=== /mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf/libdl.a(dlopen.o): In function `dlopen': (.text+0xc): undefined reference to `__dlopen' ===
You need to run the ./fixQualifiedLibraryPaths again.
See: http://stackoverflow.com/questions/13626726/an-error-building-qt-libraries-for-the-raspberry-pi for more info.
=== cc1: fatal error: .pch/release-shared/Qt5Gui: No such file or directory ===
Try adding -no-pch to the ./configure command line.
=== Cannot create forwarding script Betrete 'qtactiveqt'.git/hooks/commit-msg: Datei oder Verzeichnis nicht gefunden ===
Try:<br />
unset LANG
./init-repository -f