Qt5.1 on Rasberry Pi (full install not cross-compile)
-
Can I use this instruction for Banana Pi which using raspbian?
I confuse device name of configuration below:
./configure -v -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -optimized-qmake -reduce-relocations -reduce-exports -release -qt-pcre -make libs -prefix /usr/local/qt5 &> outputShould I use option linux-rasp-pi-g++ ?
-
Not sure if this can help but i grabbed the latest 5.4 beta source package from qt website and it actually seems to build without any patch with a cross compile toolchain.
I was able to have lots of the component to work, although something looked strange with the generated binaries and X11. like if you make a simple widegt app with qt creator, on a regular workstation (PC / mac) this wll show a small window. on the rpi it looks like a fullscreen window and doesnt behave normally (you cannot close it with the mouse, you have to kill it).
I'm currently trying to build it on the rpi natively to see how it bahaves. i'm not sure if anyone got QT 5.4 beta to build and run with a normal behaviour yet but would be interested with any feedback and specifically if any patches are required on 5.4.
Thanks.
-
I've been struggling with getting QT5 compiled for my raspberry pi. I finally found the instructions here for compiling it..
It took 46 HOURS to complete but I managed to get a working binary. Decided to save some people a lot of time,
I'm no good at doing .deb files but I tarred and bzip2'd the folder up and made it available to the public on my blog. http://tinyurl.com/kza5uob
All you need to do is uncompress/untar and sudo make install and do the modifications to bashrc..
-
I've been struggling with getting QT5 compiled for my raspberry pi. I finally found the instructions here for compiling it..
It took 46 HOURS to complete but I managed to get a working binary. Decided to save some people a lot of time,
I'm no good at doing .deb files but I tarred and bzip2'd the folder up and made it available to the public on my blog. http://tinyurl.com/kza5uob
All you need to do is uncompress/untar and sudo make install and do the modifications to bashrc..
-
Succes on a Raspberry Pi 2
It took me about 4 hours to configure and compile :)I did change the following: after ./configure and i changed "&> output" to "2>&1 | tee output", this way you can see that something happens
Same with make and I added the -j 4 option to use more processor cores:
make –j 4 2>&1 | tee make_outputTotal configure/build time: 4 hours. The cube application works, but I did not yet manage to make an xwindow application..
-
Succes on a Raspberry Pi 2
It took me about 4 hours to configure and compile :)I did change the following: after ./configure and i changed "&> output" to "2>&1 | tee output", this way you can see that something happens
Same with make and I added the -j 4 option to use more processor cores:
make –j 4 2>&1 | tee make_outputTotal configure/build time: 4 hours. The cube application works, but I did not yet manage to make an xwindow application..
-
I've been struggling with getting QT5 compiled for my raspberry pi. I finally found the instructions here for compiling it..
It took 46 HOURS to complete but I managed to get a working binary. Decided to save some people a lot of time,
I'm no good at doing .deb files but I tarred and bzip2'd the folder up and made it available to the public on my blog. http://tinyurl.com/kza5uob
All you need to do is uncompress/untar and sudo make install and do the modifications to bashrc..
@mrelcee
Thanks, after spending a good part of 2 weeks on a version incompatiblilty problem, I finally found this post, downloaded, and installed the .deb file. I am now able to continue porting an application originally written for a Fedora 19 platform. -
Hi,
This stuff is so frustrating for me. I guess I'm out of my league on this stuff.
At any rate , I downloaded and installed the .deb file in this post. That appears to work fine.
Now when I start Qt via a .pro file and attempt to configure Qt versions under build and run I QT reports this:
"The default mkspec syncline is broken". This is after I point "qmake location" to
/usr/local/qt5/bin/qmake.The QT creator version is 2.5.0
What am I doing wrong?
Thanks,
Ron -
Hi,
This stuff is so frustrating for me. I guess I'm out of my league on this stuff.
At any rate , I downloaded and installed the .deb file in this post. That appears to work fine.
Now when I start Qt via a .pro file and attempt to configure Qt versions under build and run I QT reports this:
"The default mkspec syncline is broken". This is after I point "qmake location" to
/usr/local/qt5/bin/qmake.The QT creator version is 2.5.0
What am I doing wrong?
Thanks,
Ron -
Ok,
I started from scratch and downloaded this source version: http://download.qt.io/official_releases/qt/5.4/5.4.1/single/qt-everywhere-opensource-src-5.4.1.tar.gz.mirrorlist .Twenty hours later I now have a working Qt5 environment (of sorts). The make install places Qt5 in the following directory: /usr/local/Qt-5.4.1 . The login PATH environment parameter needs to point to this directory. The PATH also needs to point to /usr/local/Qt-5.4.1/bin if you want to use qmake or any of the other Qt utilities.
I am now able compile an application that needs QT5 with qmake. Although it has a compile time bug that is unrelated to Qt.Now, I down loaded Qt Creator from: http://download.qt.io/official_releases/qtcreator/3.3/3.3.2/qt-creator-opensource-src-3.3.2.tar.gz.mirrorlist. However it will not compile due to an incompatible version of Botan (under /src/libs/3rdparty). If there is a configuration parameter to instruct qmake NOT to include the 3rdparty stuff please let me know.
Thanks,
Ron -
Ok,
I started from scratch and downloaded this source version: http://download.qt.io/official_releases/qt/5.4/5.4.1/single/qt-everywhere-opensource-src-5.4.1.tar.gz.mirrorlist .Twenty hours later I now have a working Qt5 environment (of sorts). The make install places Qt5 in the following directory: /usr/local/Qt-5.4.1 . The login PATH environment parameter needs to point to this directory. The PATH also needs to point to /usr/local/Qt-5.4.1/bin if you want to use qmake or any of the other Qt utilities.
I am now able compile an application that needs QT5 with qmake. Although it has a compile time bug that is unrelated to Qt.Now, I down loaded Qt Creator from: http://download.qt.io/official_releases/qtcreator/3.3/3.3.2/qt-creator-opensource-src-3.3.2.tar.gz.mirrorlist. However it will not compile due to an incompatible version of Botan (under /src/libs/3rdparty). If there is a configuration parameter to instruct qmake NOT to include the 3rdparty stuff please let me know.
Thanks,
Ron@RonL Did you ever get QtCreator to work properly? If so, how did you do it?
I see other posts where people have installed Arch Linux and they are getting the files from the Arch Arm repository (Qt5.4.1, QtCreator 3.3.1) but I don't want to go that route. I'd rather just download the files I need.
-
Hi,
No not as yet. I have been working with trying to get the Qt 5 libraries build with the features I need for the application that I'm trying to get working. Once that is accomplished I will focus on qtcreator. The whole process has not been pleasant.Thanks,
Ron -
Compiling on the raspberry pi is easy. Please follow my directions here:
Install packages needed for compiling:
sudo apt-get update sudo apt-get upgrade sudo apt-get install libfontconfig1-dev libdbus-1-dev libfreetype6-dev libudev-dev libicu-dev libsqlite3-dev libxslt1-dev libssl-dev libasound2-dev libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev gstreamer-tools gstreamer0.10-plugins-good gstreamer0.10-plugins-bad libraspberrypi-dev libpulse-dev libx11-dev libglib2.0-dev libcups2-dev freetds-dev libsqlite0-dev libpq-dev libiodbc2-dev libmysqlclient-dev firebird-dev libpng12-dev libjpeg62-dev libgst-dev libxext-dev libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxi-dev libdrm-dev
Then make your build directory:
mkdir ~/opt cd ~/opt
Retrieve qt5 source code from git:
git clone git://gitorious.org/qt/qt5.git
Retrieve git sources for other components
cd qt5 ./init-repository
Do not apply any patches. I got messed up with this part. The git source should compile with a few tricks in the configure parameters. First make sure you are in the qt5 directory.
cd ~/opt/qt5
Configure qt5, you need to point the CROSS_COMPILE variable to /usr/bin/g++ (without the g++) otherwise it will complain that it is not being cross_compiled (this is a hack/trick). All output is stored in the file called 'output' in case something goes wrong. At the end of the output file it should say you can run 'make', if not look for errors at the end of the output but do not be concerned with some things not building due to missing packages, there will be errors for those. The last error is the show-stopper.
Run configure:./configure -v -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -optimized-qmake -reduce-relocations -reduce-exports -release -qt-pcre -make libs -prefix /usr/local/qt5 &> output
Check the output file to see that it is building the components you need and that you can now run make. If not you may need to tweak your ~/opt/qt5/qtbase/configure script. I didn't have all of the dependencies installed when I first ran (so try the above first before changing your configure script) and I had to change the following in the ~/opt/qt5/qtbase/configure script (search for QT_CFLAGS_DBUS):
# flags for raspberry pi build # flags for libdbus-1 QT_CFLAGS_DBUS="-I/usr/include/dbus-1.0/ -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include/" QT_LIBS_DBUS=-ldbus-1 # flags for Glib (X11 only) QT_CFLAGS_GLIB="-I/usr/include/glib-2.0/ -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include/" QT_LIBS_GLIB=-lglib-2.0 QT_CFLAGS_PULSEAUDIO="-I/usr/include/glib-2.0/ -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include/" QT_LIBS_PULSEAUDIO="-lpulse -lpulse-mainloop-glib" # flags for GStreamer (X11 only) QT_CFLAGS_GSTREAMER="-I/usr/include/gstreamer-0.10/ -I/usr/include/glib-2.0/ -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include/ -I/usr/include/libxml2/" QT_LIBS_GSTREAMER=
Search for QT_CFLAGS_FONTCONFIG in the configure script. It should be below the above entries, you need to change this one in the if statement to this:
QT_CFLAGS_FONTCONFIG=-I/usr/include/freetype2/
Then you need to run make as follows (check for errors in the output_make file):
make &> output_make
If that is good then run make install (check for errors in the output_make_install file):
sudo make install &> output_make_install
After this you need to add some lines to your .bashrc file:
export LD_LIBRARY_PATH=/usr/local/qt5/lib/ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/qt5/bin
You need to source your .bashrc file to set-up the above environment variables:
source ~/.bashrc
Then run this and check that it points to /usr/local/qt5/bin/qmake
which qmake
After this you should be able to compile the sample applications and run them. Try the OpenGL Cube:
cp -r ~/opt/qt5/qtbase/examples/opengl/cube ~/ cd ~/cube qmake make ./cube
If I made any typos in the above post, please let me know. I tested this with the May 23rd version of Raspbian and it compiled fine.
-
OK, the wiki page is done!
Can someone please test this with a clean raspbian image and let me know if the configure script changes are still necessary?
"http://qt-project.org/wiki/Native_Build_of_Qt5_on_a_Raspberry_Pi":http://qt-project.org/wiki/Native_Build_of_Qt5_on_a_Raspberry_Pi
I hope this helps everyone.
@postmako I tested the Native_Build_of_Qt_5.4.1_on_a_Raspberry_Pi steps as pointed in your wiki.
Any chances you'd have pointers to make it work with PyQt5. I have install PyQt5 (
pip install python-qt5
) but I am getting this:pi@raspberrypi ~ $ python Python 2.7.3 (default, Mar 18 2014, 05:13:23) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> from PyQt5 import QtCore, QtGui, QtWebKit Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name QtCore
No sure how to read this message. I'd guessing that it still can't find Qt5 (?)