Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How can I cross-compile QT 5.0?
Forum Updated to NodeBB v4.3 + New Features

How can I cross-compile QT 5.0?

Scheduled Pinned Locked Moved Mobile and Embedded
32 Posts 5 Posters 42.8k Views 1 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.
  • Z Offline
    Z Offline
    zxzxy1988
    wrote on last edited by
    #1

    Hi all
    I am new to QT and have cross compiled QT4.5 for arm using the
    ./configure -embedded arm (also with other options)

    But in QT5, I have not find such kind of a compile command to do the cross compile. Are there any documents that can guide me to learn how to do the cross compilation?

    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to DevNet,

      You can have a look a the "RaspberryPi":http://qt-project.org/wiki/RaspberryPi_Beginners_guide guide to get the ideas of the new command line options.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        blaroche
        wrote on last edited by
        #3

        here is an example I used for Qt 5 on beaglebone:

        ./configure -v -opensource -confirm-license -xplatform linux-arm-gnueabi-g++ -opengl es2
        -prefix /usr/local/beaglebone/qt5.0-arm
        -eglfs -no-xcb -no-cups -no-dbus -no-glib
        -no-pch -no-nis -no-accessibility -no-gtkstyle
        -nomake examples -nomake tests -nomake webkit -nomake wayland -nomake qtmultimedia

        this blog maybe helpful:
        http://tigraphics.blogspot.com/

        you'll need to get your mkspecs setup correctly too.

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          zxzxy1988
          wrote on last edited by
          #4

          [quote author="blaroche" date="1366720593"]here is an example I used for Qt 5 on beaglebone:

          ./configure -v -opensource -confirm-license -xplatform linux-arm-gnueabi-g++ -opengl es2
          -prefix /usr/local/beaglebone/qt5.0-arm
          -eglfs -no-xcb -no-cups -no-dbus -no-glib
          -no-pch -no-nis -no-accessibility -no-gtkstyle
          -nomake examples -nomake tests -nomake webkit -nomake wayland -nomake qtmultimedia

          this blog maybe helpful:
          http://tigraphics.blogspot.com/

          you'll need to get your mkspecs setup correctly too.[/quote]

          Hi blaroche

          Thanks for your reply, but I am confused with the mkspecs, should I just copy the templates and modify them for my own compile toolschain, or should I change something else? I searched the internet but there seems no article telling how to write a mkspec.... could you link me some?

          Thanks!

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            The standard way is to copy the mkspec that correspond to your platform (here the linux-arm-gnueabi-g++) and update it to reflect your toolchain/additional options etc...

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • B Offline
              B Offline
              blaroche
              wrote on last edited by
              #6

              since i was configuring with -xplatform linux-arm-gnueabi-g++ i edited the mkspec in the source here:
              $qtSourceDir/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf

              start by modifying the below to your toolchain.
              @
              QMAKE_CC = arm-linux-gnueabi-gcc
              QMAKE_CXX = arm-linux-gnueabi-g++
              QMAKE_LINK = arm-linux-gnueabi-g++
              QMAKE_LINK_SHLIB = arm-linux-gnueabi-g++

              modifications to linux.conf

              QMAKE_AR = arm-linux-gnueabi-ar cqs
              QMAKE_OBJCOPY = arm-linux-gnueabi-objcopy
              QMAKE_STRIP = arm-linux-gnueabi-strip
              @

              in my case i was using an angstrom generated toolchain, changed it to:
              @
              QMAKE_CC = arm-angstrom-linux-gnueabi-gcc
              QMAKE_CXX = arm-angstrom-linux-gnueabi-g++
              QMAKE_LINK = arm-angstrom-linux-gnueabi-g++
              QMAKE_LINK_SHLIB = arm-angstrom-linux-gnueabi-g++

              modifications to linux.conf

              QMAKE_AR = arm-angstrom-linux-gnueabi-ar cqs
              QMAKE_OBJCOPY = arm-angstrom-linux-gnueabi-objcopy
              QMAKE_STRIP = arm-angstrom-linux-gnueabi-strip
              @

              thats assuming the toolchain is in your $PATH. either add it to your path or provide the full path in your qmake.conf mkspecs.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Danilo87
                wrote on last edited by
                #7

                When i get QT5 from website, i download only the .bin file and not the .tar.gz as in the previous versions! How is it possible to crosscompile without having the folder????

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  You have to download the sources to cross-compile

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    Danilo87
                    wrote on last edited by
                    #9

                    do you have a link??
                    So sorry but i'm quite new in this env!!!!

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      All downloads available are on the download page

                      "Direct link":http://download.qt-project.org/official_releases/qt/5.1/5.1.0/single/qt-everywhere-opensource-src-5.1.0.tar.gz

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        T4QT
                        wrote on last edited by
                        #11

                        I am exactly following this, as I want to cross compile qt5.1.1.1/ qt5.3.1. After downloading the source code, I have changed the

                        $qtSourceDir/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf

                        to accommodate my compiler.
                        My configuration is as below:
                        cd $QT5_SRC_PATH
                        ./configure
                        -v
                        -opensource
                        -confirm-license
                        -xplatform linux-arm-gnueabi-g++
                        -prefix $ROOT_PATH/qt5-arm \
                        -icu
                        -no-pch
                        -no-nis
                        -nomake examples
                        -nomake tests
                        -I/$ICU_PATH/install-arm/include
                        -L$ICU_PATH/install-arm/lib

                        with this configuration I am able to generate the makefile. With the make I can generate the require libraries for the QT.

                        Now I want to use glib and dbus library along with the config, so my new configuration is now:

                        cd $QT5_SRC_PATH
                        ./configure
                        -v
                        -opensource
                        -confirm-license
                        -xplatform linux-arm-gnueabi-g++
                        -prefix $ROOT_PATH/qt5-arm \
                        -icu
                        -glib
                        -dbus
                        -no-pch
                        -no-nis
                        -nomake examples
                        -nomake tests
                        -I/$ICU_PATH/install-arm/include
                        -L$ICU_PATH/_install-arm/lib
                        -I$PATH_GLIB_HEADER -I$PATH_DBUS_HEADER
                        -L$PATH_GLIB_LIB -L$PATH_DBUS_LIB

                        configuration passes with out any problem. But when I am doing make it gives me following errors:

                        In function qUncompress(): qbytearray.cpp undefined reference to compress2; returned with exit status:

                        Any idea why I am getting this.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Hi and welcome to devnet,

                          Did you re-configure from a clean source tree ? If not, you need to do a make conf-clean.

                          I would recommend using out of source builds. That way when you test something you only need to delete the build folder content to start again.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            T4QT
                            wrote on last edited by
                            #13

                            Thank you for the reply. Also one little add on in my first configuration I am also using -icu libraries ie. -licuuc -licui18n -licudata (cross compiled with arm-linux-xilinx-gnueabi-g++)

                            For the -glib and -dbus, I am using the fresh source code.

                            Correct me if my understanding is wrong, when we run the make after config; first of all the code generates the qmake utility and then qmake is used to generate the Qt library. So if I am right ; what I can see that, make is using the g++ compiler to build the qmake (instead of arm-linux-xilinx-gnueabi-g++) first. Due to this compiler when it tries to link the -licu, -ldbus and -lglib libraries (which were cross compiled using arm-linux-xilinx-gnueabi-g++) ; one of the error is :

                            /usr/bin/ld: skipping incompatible /home/$ICU_INSTALL_PATH/lib/libicu.so when searching for -licu.

                            same type of the error occurs for all the libraries ie -dbus and -glib.

                            So now at this point I have two questions;

                            1. How to use configure so that qmake can be build using arm-linux-xilinx-gnueabi-g++ compiler?

                            2. If the make process of qmake doesn't depend on compiler, then why at the first time when I was using the -icu (cross compiled) was passing and it is failing second time when I am using -glib, -dbus?

                            Can you provide little more understanding out the process, please.

                            Best Regards

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              Copy the linux-arm-gnueabi-g++ mkspec to arm-linux-xilinx-gnueabi-g++ and update it's content to use arm-linux-xilinx-gnueabi-* tools

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                                yes your suggestion helped to solve the issue related to configuration, now with that I could able to run the configuration and it generated the make file: But when I am running the make; it gives me again the same problem. So I am attaching the logs:

                                /usr/bin/ld: skipping incompatible /home/work/qt-5.1.1/../fs/fs/usr/lib/libdbus-1.so when searching for -ldbus-1
                                /usr/bin/ld: skipping incompatible /home/work/qt-5.1.1/../fs/fs/usr/lib/libglib-2.0.so when searching for -lglib-2.0
                                /usr/bin/ld: skipping incompatible /home/work/icu/install-arm/icu_build/lib/libicuuc.so when searching for -licuuc
                                /usr/bin/ld: skipping incompatible /home/work/icu/install-arm/icu_build/lib/libicui18n.so when searching for -licui18n
                                /usr/bin/ld: skipping incompatible /home/work/icu/install-arm/icu_build/lib/libicudata.so when searching for -licudata
                                /home/work/qt-5.1.1/qtbase/lib/libQt5Bootstrap.a(qbytearray.o): In function qUncompress(unsigned char const*, int)': qbytearray.cpp:(.text._Z11qUncompressPKhi+0xde): undefined reference to uncompress'
                                /home/work/qt-5.1.1/qtbase/lib/libQt5Bootstrap.a(qbytearray.o): In function qCompress(unsigned char const*, int, int)': qbytearray.cpp:(.text._Z9qCompressPKhii+0xda): undefined reference to compress2'
                                collect2: ld returned 1 exit status
                                make[3]: *** [../../../bin/moc] Error 1
                                make[3]: Leaving directory /home/work/qt-5.1.1/qtbase/src/tools/moc' make[2]: *** [sub-moc-make_first] Error 2 make[2]: Leaving directory /home/work/qt-5.1.1/qtbase/src'
                                make[1]: *** [sub-src-make_first] Error 2
                                make[1]: Leaving directory `/home/work/qt-5.1.1/qtbase'
                                make: *** [module-qtbase-make_first] Error 2

                                From the first few lines you can see that its skipping to incorporate the required cross compiled libraries:

                                When I am not including the -dbus and -glib and successfully compiling the qt libraries; I can see that there is no webkit support when I'm trying to generate the make file from the *.pro file.

                                Regards

                                1 Reply Last reply
                                0
                                • T Offline
                                  T Offline
                                  T4QT
                                  wrote on last edited by
                                  #16

                                  also I noticed that there is no webkit support even I am cross compiling the qt after enabling ICU in the configuration.
                                  After little search I came to know that it requires ruby, I went into the webkit directory and ran the qmake -o Makefile Webkit.pro.

                                  The web kit build was disabled for the following reasons:

                                  Missing ruby from the PATH:
                                  so do I need to cross compile ruby or just I need to install on the host.

                                  Please let me know.
                                  Thanks

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    Did you restart from a clean state ?

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0
                                    • T Offline
                                      T Offline
                                      T4QT
                                      wrote on last edited by
                                      #18

                                      yes I checked out fresh code and working from there

                                      1 Reply Last reply
                                      0
                                      • T Offline
                                        T Offline
                                        T4QT
                                        wrote on last edited by
                                        #19

                                        also can you please take a look at my 2nd observation about webkit.

                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          Ruby on your host

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          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