Qt4 on Raspberry Pi
-
Hey Qt community!
I have made a program for my Raspberry Pi, wheezy distro, in Qt Creator 4.7.4 but I can't figure out how to compile it to work with the Pi. I have been searching but everything I get is for Qt5. Is it even possible to compile for Raspberry with Qt4, or do I have to transit to Qt5 - and if so, how do I do it?
Thanks a lot!
Best regards
Rasmus -
Thank you for your answer!
So I have to transit to Qt 5. I would rather not but it might be the only solution.
Should I just download the latest beta from http://releases.qt-project.org/qt5.0/beta1/ and install it? Is there anything I should be aware of when going from Qt 4 to Qt 5?
-
Hi all,
I'm trying to build qt4 for my raspberry pi without success.I got the toolchain with this:
@
git clone https://github.com/raspberrypi/tools.git --depth 1
@then I edited qt-everywhere-opensource-src-4.8.3/mkspecs/qws/linux-arm-g++/qmake.conf :
@include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)QMAKE_CC = /tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-gcc
QMAKE_CXX = /tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-g++
QMAKE_LINK = /tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-g++
QMAKE_LINK_SHLIB = /tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-g++QMAKE_AR = /tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = /tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-objcopy
QMAKE_RANLIB = /tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-ranlibload(qt_config)
@
and built qt with this:
@
./configure -opensource -confirm-license -no-qt3support -release -nomake examples -nomake demos -embedded arm -little-endian -prefix /opt/qt4-4.8.3-slackrasp -qt-gfx-vnc -no-phonon -no-webkit -no-script -no-declarative -no-javascript-jit -no-pch
make
make install
@it build without errors but the library seems to be incompatible with Raspberry PI :
@
luca@slackrasp:~$ ldd /opt/qt4-4.8.3-slackrasp/lib/libQtCore.so
not a dynamic executable
@where is the problem...?
-
have a look at this "wiki page":http://qt-project.org/wiki/RaspberryPi
At the end there is a part about Qt4, with a link to the necessary specs.
Hope this helps.
-
Thanks for the link.
I tried to follow the described procedure without success.I'm using the wheezy image from "raspberry download page":http://www.raspberrypi.org/downloads .
As toolchain I used the packages from wiki page "gcc-4.7-linaro-rpi-gnueabihf.tbz":http://blueocean.qmh-project.org/gcc-4.7-linaro-rpi-gnueabihf.tbz and extracted in /gcc-4.7-linaro-rpi-gnueabihf/ .
I also copied the folder I found in "https://gitorious.org/qt-platform-mkspecs/qt-platform-mkspecs/trees/master/4.8/qws/linux-rasp-pi-g++ ":https://gitorious.org/qt-platform-mkspecs/qt-platform-mkspecs/trees/master/4.8/qws/linux-rasp-pi-g++ in my qt source folder in mkspecs/qws/ .
I mounted my raspberry rootfs in /mnt/tmp .To configure Qt I tried both the following:
@
./configure -opensource -confirm-license -no-qt3support -release -nomake examples -nomake demos -embedded rasp-pi -little-endian -prefix /opt/qt4-4.8.3-slackrasp -qt-gfx-vnc
@
@
./configure -opensource -confirm-license -sysroot /mnt/tmp/ -no-qt3support -release -nomake examples -nomake demos -embedded rasp-pi -little-endian -prefix /opt/qt4-4.8.3-slackrasp -qt-gfx-vnc
@
The second ones doesn't compile, I get some libraries errors.
@
obj/release-shared-emb-rasp-pi/qlibrary_unix.o: In functionQLibraryPrivate::load_sys()': qlibrary_unix.cpp:(.text+0xb10): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /mnt/tmp/usr/lib/arm-linux-gnueabihf/libdl.a(dlopen.o): In function
dlopen':
(.text+0xc): undefined reference to__dlopen' /mnt/tmp/usr/lib/arm-linux-gnueabihf/libdl.a(dlclose.o): In function
dlclose':
(.text+0x0): undefined reference to__dlclose' /mnt/tmp/usr/lib/arm-linux-gnueabihf/libdl.a(dlsym.o): In function
dlsym':
(.text+0xc): undefined reference to__dlsym' /mnt/tmp/usr/lib/arm-linux-gnueabihf/libdl.a(dlerror.o): In function
dlerror':
(.text+0x0): undefined reference to__dlerror' /mnt/tmp/usr/lib/arm-linux-gnueabihf/libm.a(feholdexcpt.o): In function
feholdexcept':
(.text+0x48): undefined reference to_dl_hwcap' /mnt/tmp/usr/lib/arm-linux-gnueabihf/libm.a(fesetenv.o): In function
fesetenv':
(.text+0x64): undefined reference to_dl_hwcap' collect2: error: ld returned 1 exit status gmake[1]: *** [../../lib/libQtCore.so.4.8.3] Error 1 gmake[1]: Leaving directory
/mnt/temporanea/luca/qt-everywhere-opensource-src-4.8.3/src/corelib'
gmake: *** [sub-corelib-make_default-ordered] Error 2
@The first compile without problem so I can put the libraries to my board but when I cross-compile some applications for the board and I try to execute on the board I get:
@
Illegal instruction
@where do I wrong...?
-
Hi Luca,
There is a simple solution to install Qt4 on the Pi : just apt-get it.
Have a look at the "tutorial ":http://qt-project.org/wiki/apt-get_Qt4_on_the_Raspberry_Pi I made. I hope lots of people that want to start programming discover Qt this way. Isn’t that the goal of the Raspberry Pi after all?
BTW : congrats on installing Qt5. That will be one of my next ramblings...
-
Hi Eddy,
unfortunately the tutorial you posted doesn't provide a working cross-toolchain (it seems...) .
It describe how to get a working Qt installation in the board but this way I must build my app using RaspberryPi.As I wrote in "this post":https://qt-project.org/forums/viewthread/22733/ I successfully get a working Qt5 with cross-toolchain form the Raspberry . It was not so difficult. Unfortunately for you it's in italian but if you need I can describe you what I've done.
-
bq. unfortunately the tutorial you posted doesn’t provide a working cross-toolchain (it seems…) .
Yes you are right. I didn't have the intention to use the Pi for cross compiling. I prefer to use my PC for that. ;-)thanks for the offer. I will try it first using a translator.