Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Cross-compiling to ARM with QtCreator 5.x on Windows
Forum Updated to NodeBB v4.3 + New Features

Cross-compiling to ARM with QtCreator 5.x on Windows

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
19 Posts 6 Posters 20.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.
  • L Offline
    L Offline
    Leonardo
    wrote on last edited by
    #8

    You're almost there! It's just that the last step is wrong. You should not have copied arm-linux-gnueabihf-g++.exe to g++.exe . As I said before, some tools are build for Windows and the libraries are build for Linux. Therefore, we need two compilers. If g++ is missing, it means that you're missing MinGW-w64 in your msys2 environment. First of all, check whether you have a shortcut named "MinGW-w64 Win64 Shell" in your start menu. If you do, that's the one you should be using. If you don't, you should install the package:

    pacman -S mingw-w64-x86_64-gcc

    1 Reply Last reply
    1
    • J Offline
      J Offline
      JaffaMicrobrain
      wrote on last edited by
      #9

      Ah!

      So the Raspberry Pi toolchain is used by QtCreator to build my projects for deployment on the Raspberry Pi device, whereas MinGW is used to build the Qt library for use within QtCreator on Windows?

      In which case don't I need the MinGW-32 compiler environment, since I am using QtCreator MinGW 32-bit?

      I deleted the g++.exe as you suggested and installed the MinGW-64 package into MSYS2. There was encouraging extivity but again it failed with:

      C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: project.o: Relocations in generic ELF (EM: 40)
      project.o: error adding symbols: File in wrong format
      collect2.exe: error: ld returned 1 exit status
      make: *** [../bin/qmake.exe] Error 1

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leonardo
        wrote on last edited by
        #10

        I don't get what you said about the compilers, but forget it for now.

        It seems like you have a dirty source tree. That's why you get that error. Delete your "qtsource" directory and extract the zip file again.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JaffaMicrobrain
          wrote on last edited by
          #11

          Thank you.

          So, I deleted the existing C:\qtsource and unpacked a new one. I then duplicated the \linux-arm-gnueabi-g++ directory to \linux-arm-gnueabihf-g++. Then I edited the qmake.conf to add "hf" to the file names.

          I then removed MSYS2 and reinstalled. I used the command you suggested to install MinGW64. I also used the command pacman -S diffutils as I had been getting the error "cmp: Command not found".

          I then run the configure statement:

          ./configure -platform win32-g++ -xplatform linux-arm-gnueabihf-g++ -device linux-rasp-pi2-g++ -prefix C:/Qt/5.5.1/5.5/linux-rasp-pi2 -no-icu -nomake examples -no-compile-examples -nomake tests -openssl -release -v -qreal float -skip qtwebkit -qt-zlib -skip translations -eglfs -shared -force-debug-info -opengl

          There was a lot of activity this time ending in the following error:

          Running configuration tests...
          Failed to process makespec for platform 'devices/linux-rasp-pi2-g++'
          Project ERROR: CROSS_COMPILE needs to be set via -device-option CROSS_COMPILE=<p ath>
          Could not read qmake configuration file C:/qtsource/qtbase/mkspecs/devices/linux -rasp-pi2-g++/qmake.conf.
          Error processing project file: C:\msys64\tmp\empty-file

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leonardo
            wrote on last edited by
            #12

            It's getting better. I've never used the "-device" parameter before, actually. Try something like this:

            ./configure -platform win32-g++ -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf-

            By the way, you can build it outside the source tree, so you don't need to delete it every time. Create a folder like C:\qtbuild and call the configure script from it.

            /c/qtbuild> ../qtsource/configure -platform.....

            1 Reply Last reply
            1
            • J Offline
              J Offline
              JaffaMicrobrain
              wrote on last edited by
              #13

              Thanks for the tip building outside the source tree.

              Things seem to be going backwards now. I have this tchar.h: No such file or directory error back. I am using a clean C:\qtsource and C:\qtbuild. I have been struggling with this for about an hour.

              I checked and there is a device definition for "linux-rasp-pi2-g++" in C:\qtsource\qtbase\mkspecs\devices.

              The configure statement is this:

              ../qtsource/configure -platform win32-g++ -xplatform linux-arm-gnueabihf-g++ -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -prefix C:/Qt/5.5.1/5.5/linux-rasp-pi2 -no-icu -nomake examples -no-compile-examples -nomake tests -openssl -release -v -qreal float -skip qtwebkit -qt-zlib -skip translations -eglfs -shared -force-debug-info -opengl

              This is the resulting error:

              C:/qtsource/qtbase/mkspecs/win32-g++/qplatformdefs.h:47:19: fatal error: tchar.h: No such file or directory
              #include <tchar.h>
              ^
              compilation terminated.
              make: *** [makefiledeps.o] Error 1

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Leonardo
                wrote on last edited by
                #14

                Oh, I'm sorry. My mistake. You need the whole toolchain. The command line I've posted before was only for gcc. Here:

                pacman -S mingw-w64-x86_64-toolchain

                By the way, now you should remove the -xplatform parameter, as you're using CROSS_COMPILE.

                Don't forget to clear your qtbuild folder, just to be sure.

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JaffaMicrobrain
                  wrote on last edited by JaffaMicrobrain
                  #15

                  Hi Leonardo. Sorry, I am still getting the same error:

                  In file included from C:/qtsource/qtbase/qmake/generators/makefiledeps.cpp:40:0:
                  C:/qtsource/qtbase/mkspecs/win32-g++/qplatformdefs.h:47:19: fatal error: tchar.h: No such file or directory
                  #include <tchar.h>
                  ^
                  compilation terminated.
                  make: *** [makefiledeps.o] Error 1

                  I am using this configure statement with -xcompile omitted:

                  ../qtsource/configure -platform win32-g++ -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -prefix C:/Qt/5.5.1/5.5/linux-rasp-pi2 -no-icu -nomake examples -no-compile-examples -nomake tests -openssl -release -v -qreal float -skip qtwebkit -qt-zlib -skip translations -eglfs -shared -force-debug-info -opengl

                  I installed "all" packages using the pacman command that you suggested. I also deleted and create a new C:\qtbuild directory.

                  Edit #1

                  I did some digging around and can confirm that tchar.h is located in:

                  C:\msys64\mingw64\x86_64-w64-mingw32\include

                  Edit #2

                  After reading more Qt documentation (why don't they date their documentation?), I suspect that this latest error is arising from not having and specifying a SYSROOT. I could be wrong of course. Am I required to have a Raspberry Pi image available on the Windows 7 platform to provide this sysroot? It seems to be a step taken in the instructions for cross-compiling Qt for RaspberryPi2 from Ubuntu.

                  I also struggle with is the role of the two toolchains here. There is the MinGW64 hosted within MSYS2. There is also the Win64 toolchain for Raspberry Pi downloaded from SysProgs.

                  Help!

                  1 Reply Last reply
                  0
                  • Bingo5B Offline
                    Bingo5B Offline
                    Bingo5
                    wrote on last edited by
                    #16

                    Hi JaffaMicroBrain.

                    I have the same problem.
                    I try to croos compile from windows and it seems that the file tchar.h is missing.
                    I've followed this tuto http://visualgdb.com/tutorials/raspberry/qt/embedded/
                    but still having the same problem.
                    Have you found any solutions to this ?

                    Regards,

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      MikePelton
                      wrote on last edited by
                      #17

                      After quite some hours of "fun" I managed to get the (excellent) set of instructions at:

                      http://visualgdb.com/tutorials/raspberry/qt/embedded/

                      to work on Windows 10. The trick was to start with a completely clean version of Raspbian, and then to install QT 5.5:

                      sudo apt-get install qt5-default

                      Note that I didn't also install Qt Creator on the PI.

                      If you then follow the instructions to the letter, all will be well.

                      I found the UpdateSysroot step painful as my network was having a bad day - rather than synching /opt it will be faster to synch just /opt/vc.

                      The make step has taken about 6 hours.

                      I had originally started out with more dev stuff installed on the PI and ran into issues with missing header files as you guys have done, but this way worked. Hope it works for you too! Regards, Mike

                      U 1 Reply Last reply
                      1
                      • M MikePelton

                        After quite some hours of "fun" I managed to get the (excellent) set of instructions at:

                        http://visualgdb.com/tutorials/raspberry/qt/embedded/

                        to work on Windows 10. The trick was to start with a completely clean version of Raspbian, and then to install QT 5.5:

                        sudo apt-get install qt5-default

                        Note that I didn't also install Qt Creator on the PI.

                        If you then follow the instructions to the letter, all will be well.

                        I found the UpdateSysroot step painful as my network was having a bad day - rather than synching /opt it will be faster to synch just /opt/vc.

                        The make step has taken about 6 hours.

                        I had originally started out with more dev stuff installed on the PI and ran into issues with missing header files as you guys have done, but this way worked. Hope it works for you too! Regards, Mike

                        U Offline
                        U Offline
                        user330
                        wrote on last edited by
                        #18

                        @MikePelton I am struggling to get the cross-compiling working for the past three days. while syncing my PI with the windows PC, I have seen all the paths in the above link you have mentioned, but i could not find the /opt. Could you please suggest me, where can be the problem. I have followed exactly the same steps as in http://visualgdb.com/tutorials/raspberry/qt/embedded/ except that my debian jessie was old.

                        1 Reply Last reply
                        0
                        • isoftengineerI Offline
                          isoftengineerI Offline
                          isoftengineer
                          wrote on last edited by
                          #19

                          Hi All, after years I have same problem. Do you have any solution?

                          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