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. Need help on Cross compiling Qt 5.1.1 on Imx6
Forum Updated to NodeBB v4.3 + New Features

Need help on Cross compiling Qt 5.1.1 on Imx6

Scheduled Pinned Locked Moved Mobile and Embedded
43 Posts 5 Posters 28.3k 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.
  • clogwogC Offline
    clogwogC Offline
    clogwog
    wrote on last edited by
    #12

    you can't cross compile a qt program yet, because you don't have the qt libraries cross-compiled yet. that's the whole reason of this.

    first try a simple "hello world"
    http://en.wikibooks.org/wiki/C++_Programming/Examples/Hello_world
    and instead of using g++ to compile it, use arm-none-linux-gnueabi-g++ that is located in the arm-2013.05/bin/

    you'll end up with a hello file that you can run on the imx6 board.
    you can check on your pc by checking what architecture it was build for by

    @file hello@
    and it should tell you that it is compiled for ARM

    copy it onto your imx6 machine and run it
    @./hello@

    if this all works, can you tell me the full path were arm-none-linux-gnueabi-g++ was installed on your machine ?

    1 Reply Last reply
    0
    • E Offline
      E Offline
      eimarcos
      wrote on last edited by
      #13

      Hi,

      Sorry for the late post, I got sick and need to take a couple of days plus the weekend to recuperate. Back to the topic :D

      Oh I see, I went a little over board, just a bit exicited :-D I did what you ask me to do. I compiled a simple helloWorld (main.cpp) program and arm-none-linux-gnueabi-g++ and created an exe file(mainarm). I type "file mainarm", here's the description:

      mainarm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

      I copied it to the extension card of the imx6. I did go the directory of the file where it was copied, tried to run it by typing "./mainarm" but encountered an error "no such file or directory" error. Type "ls" to check if the file exist, unfortunately I can see in the directory :( Did I get it wrong ? Did I miss something? or Do I have to setup something in the board first to make it work? Thank you in advance for your reply :D

      And to answer your query(though it's still not working), the full path of arm-none-linux-gnueabi-g++ is '/home/erick/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin'

      1 Reply Last reply
      0
      • clogwogC Offline
        clogwogC Offline
        clogwog
        wrote on last edited by
        #14

        output of file looks good !

        did you transfer the file using a usb stick ? it might have lost it's executable flag (FAT file-system and linux attributes don't mix very well) .. try
        @chmod +x mainarm@
        then
        @ ./mainarm@
        again

        if that also fails do a :

        @ldd mainarm@

        and see if all libraries that your executable is linked to can be found (post reply here)

        1 Reply Last reply
        0
        • E Offline
          E Offline
          eimarcos
          wrote on last edited by
          #15

          Hi,

          Already done the two steps you mentioned. The first step didn't work. and on the second step it displayed an error "Not a dynamic executable" (currently looking up at google to know what does mean :-D ).

          What should I do next? Thanks

          On a side note:
          Tried also "file mainarm" and it return an error "no such file or directory"

          1 Reply Last reply
          0
          • clogwogC Offline
            clogwogC Offline
            clogwog
            wrote on last edited by
            #16

            whoa..!!

            does
            @file mainarm@
            tell you anything else on the imx6 machine?
            what does file on any other existing binary (one that you can run) on your card say ?

            how about an ldd on an existing binary on your card ? does that work ?
            i'm clutching at straws here. anyone else have an idea whats going on here ?

            1 Reply Last reply
            0
            • E Offline
              E Offline
              eimarcos
              wrote on last edited by
              #17

              Hi,

              Here are the steps I have done after compiling the main.cpp using the arm-none-linux-gnueabi-g++. I named it "mainarm". And compiled another using the standard g++ compiler, I named it "main"

              1. From the host ( verified both the file info and shared library dependencies ):

              from the command file:

              main:
              main: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xf1b6a3f9a35639d7ff2cce0b8337f51ed9891dc5, not stripped

              mainarm:
              mainarm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

              from the command ldd:

              main:
              linux-gate.so.1 => (0xb777f000)
              libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb767e000)
              libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb74ca000)
              libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7486000)
              /lib/ld-linux.so.2 (0xb7780000)
              libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7469000)

              mainarm:
              not a dynamic executable

              1. From the imx6 device:

              from the command file:

              for both files it displayed an error "command not found"

              from the command ldd:

              for both files it displayed an error "not a dynamic executable"

              1 Reply Last reply
              0
              • clogwogC Offline
                clogwogC Offline
                clogwog
                wrote on last edited by
                #18

                wouldn't have thought that a g++ compiled program would do anything on the imx6. it's the wrong architecture, so that's not a surprise

                what do you see when you do

                file /bin/touch
                and
                ldd /bin/touch

                on the imx6 ?

                1 Reply Last reply
                0
                • clogwogC Offline
                  clogwogC Offline
                  clogwog
                  wrote on last edited by
                  #19

                  perhaps file is not installedo n your imx6 ?
                  what does it say when you run:

                  which file

                  on the imx6 ?

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    eimarcos
                    wrote on last edited by
                    #20

                    Hi,

                    when I type (on the imx6)

                    • file /bin/touch it returned :
                      "command not found"

                    • ldd /bin/touch it returned:
                      "librt.so.l => /lib/arm-linux-gnueabihf/librt.so.l (0x2acd9000)
                      libc.so.6 => /lib/arm-linux-gnueabihf/libc.so6 (0x2ace7800)
                      /lob/ld-linux-armhf.so.3 (0x2abld880)
                      libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x2ab62000)"

                    -with "which file" nothing happens

                    Well I think file is not installed on the imx(as you suggested). how could I install it? I tried to connect it with a network cable and open up the chrome browser(which is built in), it can't browse the net. Also tried to ping my computer, it can't see it in the network. But on the system preference it shows a "wired connection"

                    And what does this mean?
                    "wouldn’t have thought that a g++ compiled program would do anything on the imx6. it’s the wrong architecture, so that’s not a surprise_" --- does it imply I used the wrong compiler? should I use a different one? what should I use? Sorry, I'm a little bit confuse on whats happening :-( or just referring to other file I compiled with the standard g++ compiler

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      eimarcos
                      wrote on last edited by
                      #21

                      Hi,

                      Well I'm just guessing, could it be possible I'm using a different image for imx6 that making me encounter different errors. If it's not too much to ask, could you give me information what image are you using on your board and where to download it? So I can install and run it to my board. Thanks in advance :-D

                      1 Reply Last reply
                      0
                      • E Offline
                        E Offline
                        eimarcos
                        wrote on last edited by
                        #22

                        Hi,

                        Who would have thought my hunch was right. I downloaded a different image for imx6 and installed it to the unit. Seems everything is working as expected.

                        When typing "file mainarm" it displays :

                        mainarm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

                        and on "ldd mainarm" shows:

                        libstdc++.so.6 => /usr/lib/arm-linux-gnueabi/libstdc++.so.6 (0x2acc4000)
                        libm.so.6 => /lib/arm-linux-gnueabi/libm.so.6 (0x2abea000)
                        libgcc_s.so.1 => /lib/arm-linux-gnueabi/libgcc_s.so.1 (0x2ab08000)
                        libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0x2ad6f000)
                        /lib/ld-linux.so.3 (0x2aae3000)

                        tried the file by typing "./mainarm", the program works!

                        So what's next? :-D

                        1 Reply Last reply
                        0
                        • clogwogC Offline
                          clogwogC Offline
                          clogwog
                          wrote on last edited by
                          #23

                          ah good good.
                          now here comes the time-consuming part:

                          take the sd card out and copy everything (cp -r ) from the card to a directory on your local machine. put it somewhere under a directory called rootfs or so
                          for example /home/erick/projects/rootfs/

                          this is because the cross compile will be for that particular setup and it needs all the include files and libraries on that card. we will be copying this card a few times as we find out missing libraries (in lib packages) and header files (in lib-dev packages)

                          go to your qt 5.1.1 source directory and cd into qtbase
                          then run ./configure

                          and keep in mind that this will take a while to get right

                          @cd qtbase
                          ./configure -opensource -confirm-license -icu -qt-xcb -make libs -no-pch -opengl es2 -prefix /opt/qt5.1.1-armel -device-option CROSS_COMPILE=/home/erick/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-fsl-linux-gnueabi- -device imx6 -sysroot /home/erick/projects/rootfs/ -no-gcc-sysroot@

                          and i am expecting a lot of errors, so don't worry yet.

                          1 Reply Last reply
                          0
                          • E Offline
                            E Offline
                            eimarcos
                            wrote on last edited by
                            #24

                            So I assume this will be the hard part and as you said its time consuming, so I better be get started :-D

                            Before I proceed, can I make one clarification first. On my system, I think theres two qt programs (I'm assuming they are not the same because one is on a qt5 folder and the other is Qt5.1.1)

                            I got Qt5.1.1 from http://qt-project.org/downloads using the file "Qt 5.1.1 for Linux 32-bit (417 MB) " to install it(which is a GUI installer and I use default setting for installing) which created a folder on my system ( '/home/erick/Qt5.1.1')

                            I got qt5 from following this procedure:(https://community.freescale.com/docs/DOC-94066)

                            QT5

                            These steps are performed on the host

                            1. Download the git respository for qt5:

                              $ git clone git://gitorious.org/qt/qt5.git qt5

                              $ cd qt5

                              Let us consider this as <QTDir>

                            2. Create a build directory to install for the qt5 packages. This directory can be in any loctation. For example,

                              $ sudo mkdir /opt/qt5

                              $ sudo chown -R <username> /opt/qt5

                            Let us consider the the installdir as /opt/qt5

                            1. Enter the Qt5 directory and run the init-repository script to download all the source code for
                              Qt5. To download all the source code will take about an hour.

                              $ ./init-repository

                              Update: In the latest Qt5 release the webkit library is included by default and there are some issues trying to compile it.

                              use the next line to avoid problems if not desired to use webkit.

                              $ ./init-repository --no-webkit
                              ===============================================================

                            which created a folder on my system (/home/erick/qt5).

                            Now the problem is, you mentioned
                            "go to your qt 5.1.1 source directory and cd into qtbase
                            then run ./configure"

                            I can't find "configure" file nor the "qtbase" folder on the Qt5.1.1 folder. But it can be found on the qt5 folder (both the qtbase folder and configure file). Logically, I should pick the qt5 folder because it has the component, and run configure (right?) Would it be a problem in the future (assuming I got the correct configuration), that I have only an installation of qt creator for Qt5.1.1 and not for qt5? Can't find also qtcreator on the qt5 folder :-(

                            on a side note:

                            both folders(Qt5.1.1 and qt5) contains the files "qeglfshooks_imx6.cpp, qmake.conf, and qplatformdefs.h" though in different paths.

                            on the qt5 folder it can be found on '/home/erick/qt5/qtbase/mkspecs/devices/linux-imx6-g++'

                            on the Qt5.1.1 folder it can be found on '/home/erick/Qt5.1.1/5.1.1/gcc/mkspecs/devices/linux-imx6-g++'

                            I know this is quite a reading, and I do apologize. I just want you to a have a big and clear picture of what's going on over at my part. I really do appreciate the time and effort your putting out in order to help me. Again, Thank you very very much :-D

                            1 Reply Last reply
                            0
                            • clogwogC Offline
                              clogwogC Offline
                              clogwog
                              wrote on last edited by
                              #25

                              the binary (GUI) installer was for your local machine ( intel 32 bit) so we'll ignore that one, we need the sources

                              after you do a
                              git clone git://gitorious.org/qt/qt5.git qt5

                              and look in the qtbase directory, you'll probably see that it is completely empty.. they (recently ?) split up all the subprojects into stand alone git projects...
                              so just go to the /opt/qt5 directory (do a "git pull" to get the latest version )
                              then also checkout qtbase
                              git clone git://gitorious.org/qt/qtbase.git

                              after that you should see the configure script appear in qtbase.

                              1 Reply Last reply
                              0
                              • E Offline
                                E Offline
                                eimarcos
                                wrote on last edited by
                                #26

                                Ok got it. Ignorning the GUI installed qt.

                                git clone git://gitorious.org/qt/qt5.git qt5 - DONE
                                and yes the '/home/erick/qt5/qtbase' folder is empty.

                                entered the directory /opt/qt5 folder,
                                did "git clone git://gitorious.org/qt/qtbase.git". And now I can see a "configure" file and "configure.bat" file in the directory under /opt/qt5/qtbase.

                                should I do these now:

                                cd qtbase
                                ./configure - opensource - confirm-license - icu - qt- xcb - make libs - no-pch - opengl es2 - prefix /opt/qt5.1.1-armel - device-option CROSS_COMPILE=/home/erick/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-fsl-linux-gnueabi- -device imx6 -sysroot /home/erick/projects/rootfs/ -no-gcc-sysroot

                                how about "-prefix /opt/qt5.1.1-armel -device-option" I assume its pertaining to a directory in which I know I don't have. Or should I just type everything as you instructed.

                                1 Reply Last reply
                                0
                                • clogwogC Offline
                                  clogwogC Offline
                                  clogwog
                                  wrote on last edited by
                                  #27

                                  -prefix /opt/qt5.1.1-armel

                                  is where the make install (at the end of all this) will install your cross-compiled qt (on your rootfs )

                                  additional it is also where the make install will install the qmake on your local machine that you will need for cross-compiling

                                  it doesn't matter what you call it, i just called it qt5.1.1-armel because i also have natively compiled versions of qt on my disk, this way i know which is which.

                                  isn't it working ?

                                  1 Reply Last reply
                                  0
                                  • E Offline
                                    E Offline
                                    eimarcos
                                    wrote on last edited by
                                    #28

                                    Currently copying files from the sd card to the host compuater. I'm having a problem with limited storage on my drive. Would it matter if instead I copy it to "/home/erick/projects/rootfs/" I would put it to an additional drive. the path would be "/media/erick/Development-Files/iMx6Files/rootfs' then I would put it as the sysroot directory when Im in the configuring procedure?

                                    1 Reply Last reply
                                    0
                                    • E Offline
                                      E Offline
                                      eimarcos
                                      wrote on last edited by
                                      #29

                                      I have run the configure file almost exactly the same as your parameters except with the directory path for sysroot. I have encountered this error:

                                      "Running configuration tests...
                                      Failed to process makespec for platform 'devices/linux-imx6-g++'
                                      Turn on verbose messaging (-v) to see the final report."

                                      As you expected :-D

                                      1 Reply Last reply
                                      0
                                      • E Offline
                                        E Offline
                                        eimarcos
                                        wrote on last edited by
                                        #30

                                        hi,

                                        I managed to fix the the first error problem, but another error showed up. It shows "Could not dertemined target architecture". What could that be? I have no clue :-(

                                        Here's the complete error message:

                                        This is the Qt Open Source Edition.

                                        You are licensed to use this software under the terms of
                                        the Lesser GNU General Public License (LGPL) versions 2.1.

                                        You have already accepted the terms of the license.

                                        <srcbase> = /opt/qt5/qtbase
                                        <outbase> = /opt/qt5/qtbase
                                        Creating qmake...
                                        make: Nothing to be done for `first'.
                                        Running configuration tests...
                                        Note: PKG_CONFIG_LIBDIR automatically set to /media/erick/Development-Files/iMx6Files/rootfs/usr/lib/pkgconfig:/media/erick/Development-Files/iMx6Files/rootfs/usr/share/pkgconfig:/media/erick/Development-Files/iMx6Files/rootfs/usr/lib/arm-none-linux-gnueabi/pkgconfig
                                        Note: PKG_CONFIG_SYSROOT_DIR automatically set to /media/erick/Development-Files/iMx6Files/rootfs

                                        Could not determine the target architecture!
                                        Turn on verbose messaging (-v) to see the final report.
                                        The ICU library support cannot be enabled.
                                        Turn on verbose messaging (-v) to ./configure to see the final report.
                                        If you believe this message is in error you may use the continue
                                        switch (-continue) to ./configure to continue.

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          Soilworker
                                          wrote on last edited by
                                          #31

                                          Hello,

                                          just wanted to share my experience with wandboard-dual iMX6 and Yocto.

                                          The easiest way would be to just take Yocto to build your image with QtEmbedded. Freescale is delivering the following layer to add support
                                          https://github.com/Freescale/fsl-community-bsp-base for a couple of development boards. Even if you don't use the image itself, you will find the proper configuration to configure and cross compile Qt for the iMX6.

                                          So just building an image for one of the supported iMX6 development boards, and look in the log-files what bitbake did in the background would propably help you to get it running for your board as well.

                                          Kind Regards
                                          Soilworker

                                          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