Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. Qt5.1 on Rasberry Pi (full install not cross-compile)
Forum Updated to NodeBB v4.3 + New Features

Qt5.1 on Rasberry Pi (full install not cross-compile)

Scheduled Pinned Locked Moved QtonPi
93 Posts 24 Posters 118.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jackokring
    wrote on last edited by
    #3

    Doesn't the Qt installer from the downloads page work? I'm interested in Qt 5.1+ too.

    I have set up a Linux PC with the 5.1, and done a few modifications to the beginning of my code. Mainly due to QT += changes in the .pro file, and some #include changes. Yes, the app now uses OpenGLES2. Now it would be good if I could also develop on the Pi too, with a hardware acceleration and webkit.

    I decided to use ALSA for sound as I need realtime rendering, and not just samples. Are you sure the Pi has enough memory to compile the sources?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #4

      Qt precompiled stuff is compiled for x86, Raspbery uses ARM architecture. It won't work. You need to compile (or crosscompile) yourself.

      (Z(:^

      1 Reply Last reply
      0
      • T Offline
        T Offline
        trogos99
        wrote on last edited by
        #5

        I have the same problem. I tried to compile it for 4 times, with no success.
        My question is. Nobody can compile it and put on the cloud a working OS?.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          postmako
          wrote on last edited by tekojo
          #6

          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.

          J 1 Reply Last reply
          0
          • P Offline
            P Offline
            postmako
            wrote on last edited by
            #7

            I should add that it takes 2 days to compile with make on the raspberry pi. The configure and make install are fairly quick. I now have a pi that I can run qmake on and it works with OpenGL ES.

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #8

              This is ultra cool :) I recommend you create a wiki page from this post :D

              (Z(:^

              1 Reply Last reply
              0
              • P Offline
                P Offline
                postmako
                wrote on last edited by
                #9

                I would like to, but I'm ignorant of the process. Could someone help and give me a bit of guidance?
                Thanks,
                Kory

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #10

                  I've found 2 similar pages "here":http://qt-project.org/wiki/RaspberryPi and "here":http://qt-project.org/wiki/Qt5OnRaspberryPi.

                  You can create a new wiki page by going "here":http://qt-project.org/wiki and clicking on "Create new page" in the right side-pane.

                  (Z(:^

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    postmako
                    wrote on last edited by
                    #11

                    Thanks for the wiki tip sierdzio. Regarding the compilation links, and I mean this with all due respect, those links are not native builds, they are cross compiled builds. The instructions I have posted are for building everything on the Raspberry Pi itself without any dependency on a host/desktop system.

                    [quote author="sierdzio" date="1374753686"]I've found 2 similar pages "here":http://qt-project.org/wiki/RaspberryPi and "here":http://qt-project.org/wiki/Qt5OnRaspberryPi.

                    You can create a new wiki page by going "here":http://qt-project.org/wiki and clicking on "Create new page" in the right side-pane.[/quote]

                    1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #12

                      I know, I just linked them so that you are aware of them ;) I think both are rather outdated, too.

                      (Z(:^

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        postmako
                        wrote on last edited by
                        #13

                        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.

                        J 1 Reply Last reply
                        1
                        • sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #14

                          Thanks, I've tagged the page. I'll probably test once I get a Raspberry.

                          (Z(:^

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            trogos99
                            wrote on last edited by
                            #15

                            Thanks, for your answer postmako.
                            I'll try again, with your guide,

                            1 Reply Last reply
                            0
                            • R Offline
                              R Offline
                              RodriguesCunha
                              wrote on last edited by
                              #16

                              Thanks for your input, sierdzio and postmako.
                              I'm trying to build using some instructions i had previously found (using some from cross-compile using a desktop machine and for build to Linux desktop).
                              It´s already compiling for almost a day now (after 2 unsuccessful attempts). If it doesn't work i will try postmako approach.

                              Once again, thanks for your instructions postmako, because the only instructions i could find related to the RPi were using cross-compile with a desktop machine.

                              1 Reply Last reply
                              0
                              • P Offline
                                P Offline
                                postmako
                                wrote on last edited by
                                #17

                                Yeah let me know how the instructions work for you. Note that you should use the instructions at the wiki link because I have updated and corrected them when I ran the compilation a second time. The configure script changes are required in order to get it to compile those modules.

                                Enjoy...

                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  RodriguesCunha
                                  wrote on last edited by
                                  #18

                                  Hi, postmako

                                  I'm now following your instructions because my other attempt failled after 2 days compiling...
                                  I started last night, so it's been compiling for only 24h. Tomorrow i will let you know how it went.

                                  Tell me one thing, because i want to build apps using the X windows, not from console, do i need to do the part related to the .bashrc? You should also say this in the wiki you created and if it's necessary to do anything else for x windows.

                                  On your instructions i have 4 remarks:
                                  1- you should include that it's necessary to do sudo apt-get install git (if it's not installed), in order to use git.
                                  2- when you say "Then before closing the file search for QT_CFLAGS_FONTCONFIG in the configure script. It should be below the above entries, you need to change the one in the if statement to this:"
                                  If i understood correctly you should say it's in the else (which is empty) part of the if .
                                  3- you should say where .bashrc is located and the full file name bash.bashrc.
                                  4- previously stated about X windows.

                                  I only stated some things that may be obvious for those who are used to Linux, but not for me (little experience on Linux).

                                  Once again, thanks for your instructions.

                                  1 Reply Last reply
                                  0
                                  • P Offline
                                    P Offline
                                    postmako
                                    wrote on last edited by
                                    #19
                                    1. Did you use the May 23rd Raspbian version? Mine had git installed already.
                                    2. Yeah, this is a bit unclear and that is why I included the diff file.
                                    3. Yeah the .bashrc I was referring to is located at ~/.bashrc but you can modify the bash.bashrc file as well (at least I think you can.) Let me know if it works.
                                    4. I'm not sure what else you need to do for x-windows but I think you still need the directories set-up in the .bashrc file even for x-windows otherwise it will not know where qmake or Qt5 is located.
                                    1 Reply Last reply
                                    0
                                    • R Offline
                                      R Offline
                                      RodriguesCunha
                                      wrote on last edited by
                                      #20

                                      Hi postmako.
                                      I wasn't using May 23rd version, i was using one older.
                                      I asked about .bashrc, because i couldn't find it, because it's a hidden file (at least in my version it's hidden).
                                      My installation was ok and i could run the cube example like you said.

                                      But now i have two other problems.
                                      I can't find the qtcreator exec in X windows.
                                      The second one is that i need to use qtserialport and when i tried to build the example project using terminal i get unknow module in Qt: serialport. Why is that? In my other machine, running Ubuntu, when i installed Qt5.1 all modules (including qtserialport) are installed.
                                      Can you help me with these 2 problems?

                                      Thanks for your time.

                                      1 Reply Last reply
                                      0
                                      • P Offline
                                        P Offline
                                        postmako
                                        wrote on last edited by
                                        #21

                                        To get qtcreator follow these instructions but use your Qt5.1 instead of Qt4 like the instructions state: "http://www.raspberrypi.org/phpBB3/viewtopic.php?f=31&t=43545":http://www.raspberrypi.org/phpBB3/viewtopic.php?f=31&t=43545

                                        After you try that, please let me know if it works for you or not. I will probably try it if I find some time.

                                        I'm able to compile with QtSerialPort, could you post your source code and the "*.pro" file for it? If that looks good then I would like to see your "output" file from the compilation to see if something got missed or skipped over. It could also be that your older version of Raspbian doesn't support it. It's hard to say and maybe someone who is more informed than me could help you.

                                        1 Reply Last reply
                                        0
                                        • R Offline
                                          R Offline
                                          RodriguesCunha
                                          wrote on last edited by
                                          #22

                                          Hi.

                                          The instructions you told me, i think they will install for Qt4, because using

                                          • sudo apt-get install Qtcreator

                                          it will install Qt creator 2.5 (Qt4.8)
                                          but i will try it...

                                          Related to qserialport, i tried to build the example project enumerator and it gave me the error.

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved