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 27.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.
  • E Offline
    E Offline
    eimarcos
    wrote on last edited by
    #1

    Hi, just need help on how could I cross compile my Qt program on IMX6. I have been following the steps I have found on forums (https://community.freescale.com/docs/DOC-94066) but honestly I was more confused. Could anyone be so kind to point me to the right direction. Like a checklist of what I should have, steps to follow, and an explanation on why(although not required but It would be a great help and deeply appreciated). I'm very new to linux and specially to embedded system development. So please take it easy on me :-D

    Thanks in advance guys :-)

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

      how far did you get ?
      what kind of setup do you have ?
      do you use the freescale provided filesystem and kernel ?
      do you have the freescale cross compiler setup and running ?

      when they talk about the rootfs in the instructions at freescale they mean a complete copy of the sd card's filesystem. at the end of the cross compile it will install it onto the rootfs as well, so you just need to put it back onto the card.

      when i get back to work tomorrow, i'll go through my notes and post the ./configure parameters for my imx6 setup.. it's a bit different from the freescale filesystem, but i'm using xcb for the graphics on xwin and got almost everything running. (not 100% sure if qml 2.0 is running)

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

        Hi clogwog,

        thanks for your quick response. Frankly, I'm not quite on how to answer your question. I have really no idea on what I'm doing, or If it is right way to do it(I assume it is right, because other are doing it :-D ). I'll just tell you what I have done so far, hope it can give you a much added detail.

        So here it goes:

        On the development board, I have program the image I have found on this website (http://www.embest-tech.com/community/index.php?topic=2769.0). Tested it, and fortunately it was a success. Connected it to an hdmi display and can see the light blue Windows-like layout interface.

        On the develepment pc (Host), which is running on 32 bit ubuntu 13.04. I have a running Qt 5.1.1. I can compile and run programs for desktop application. For the cross compilation, I have followed the steps on this topic (https://community.freescale.com/docs/DOC-94066) on QT5. I was able to follow steps 1-3 (which created a folder of qt5 in my directory with a bunch of folders and files inside it). And from step 4 onward, everything became confusing for me :-( Tried to read more post about it, and read something about yocto build (https://community.freescale.com/message/297775#297775) and Adeneo Embedded (https://community.freescale.com/docs/DOC-96390) made it a lot confusing.

        So far that all I was able to do after reading and trying out stuff out for myself. Unfortunately, I think I'm no where near on a solution. That's what lead me to seek help for knowledgeable peoples (just like you :-D) help to point me to the right direction, and possibly point out what I have being doing wrong.

        Hope that could give you an idea on what I have been up to. And I really do appreciate spending your time helping me out.

        Regards

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

          hi eimarcos,

          i've struggled through the cross compile recently, and it was a very steep learning curve.

          i can't give you exact steps because i didn't completely document it. during the couple of weeks i was working on it , i had a couple of dead ends and had to start again. it is also dependent on the particular hardware, kernel and filesystem you have.

          first thing you will need is a cross compiler. we took the the one from freescale because our imx6 is from freescale. just make sure it works before you continue by creating a little hello world and running it on the unit. (i installed my crosscompiler in /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/ )

          then take the sdcard out of your unit and copy the whole thing to a directory on your pc. name it rootfs or so. ( i put it in /home/tom/Downloads/qt/rootfs )

          then download the qt5.1.1 sources, extract the tar file

          @cd qtbase@

          the run configure

          i used:

          @./configure -opensource -confirm-license -icu -qt-xcb -make libs -no-pch -opengl es2 -prefix /opt/qt5.1.1-armel -device-option CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi- -device imx6 -sysroot /home/tom/Downloads/qt/rootfs -no-gcc-sysroot @

          during the ./configure you will run into a lot of problems.. and it mainly has to do with missing libraries , include files, and PATH settings. i just went through them one by one by finding out which missing file can be found in what package, installing the package on my running unit (using apt-get install ) and then re-copying the card's rootfs to the pc's disk )

          getting the es2 opengl driver accepted in the ./configure was particularly hard.. but i hope your file system is already setup correctly.

          after this you can do :

          make
          and
          sudo make install

          if this works you have gone through the hardest part, you then only have to compile to non-qtbase parts, which is a lot easier because you'll have a qmake that will setup everything..

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

            HI clogwog,

            You make it seems a lot easier. And how I wish it was that easy. Just like you have said "it was a very steep learning curve".

            Referring to the cross compiler part, How can I know If I had already Installed it? If not, how can install it? Based on your response I should be installing it on the unit, right? I searched the freescale website using the keyword "cross compiler", then look under "Software development tool", filtered the vendors on "freescale" only. List is showing not a single hint for cross compiler for imx6 or I just don't know what I'm looking for :-(

            Thanks in advance for your response.

            Regards!

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

              ah, i see freescale now points to

              http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/request?id=478dff82-62bc-44b2-afe2-4684d83b19b9&downloadlite=scblite2012&fmpath=/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/form

              it's a free download, i hope it's only the cross compiler, but it might include an IDE as well. i'm downloading it at the moment as well.

              i can swear i downloaded the cross compiler directly from freescale. oh well, if this doesn't work i can tar up the cross compiler from my machine.

              cross-compiling means compiling it on one architecture for another architecture. so no you wouldn't install it on the unit itself, only on your pc

              it is however always an option to try to compile it nativily on the unit using the g++ compiler (is available on your linaro filesystem using apt-get )

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

                currently downloading it as of writing. It is the "arm-2013.05-24-arm-none-linux-gnueabi.bin" with a file size of 145.67MB? Its gonna take a while to download. I'll update you If I finished downloading it. Thanks you so much for you help :-D

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

                  i didn't run the .bin on my home computer but the arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 on that same page looks alright as well. the .bin might setup your environment as well.

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

                    Just finished downloading the files. Bad internet connection. Sigh :( I download both the bin and tar file, which one should I use. Is a bin file equivalent of an .exe file in windows? About the tar file, I'll just Google on how to extract it. Should I mimic the same directory path you have?

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

                      i think you can run the binary by just making it executable

                      chmod +x arm-2013.05-24-arm-none-linux-gnueabi.bin
                      then you can run it
                      ./arm-2013.05-24-arm-none-linux-gnueabi.bin

                      no need to make the same directory path as me, i think mine is in a weird location, but everyone in the department has it there..

                      just keep an eye out where it installs things. if it doesn't look right just extract the tar file. and place the result somewhere where you'll remember /opt/.. or so

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

                        Hi,

                        Finish installing the bin file using the GUI installer. Is it safe to assume I have an cross compiler installed on my host computer? Like as you said, I should check first if it is working. I have a working qt program which is compiled for pc, how to compile it for the imx6 board? and how run it onto the unit? (I mean, do I just copy the compiled file to the unit then run it like an executable file). Sorry, I'm just really new in to this stuff.

                        1 Reply Last reply
                        0
                        • 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

                                          • Login

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