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. Setup Qt on windows 7 to cross compile for Raspberry Pi 2

Setup Qt on windows 7 to cross compile for Raspberry Pi 2

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
18 Posts 4 Posters 7.6k Views
  • 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.
  • avgjoecoderA Offline
    avgjoecoderA Offline
    avgjoecoder
    wrote on last edited by A Former User
    #1

    So I will start off by saying that I do NOT want know how to setup or run Qt on the pi. I am specifically trying to setup Qt Creator 4.0.3 (Based on Qt 5.7.0 (MSVC 2013, 32 bit)) to write and compile C++ and the run the result on the Raspberry pi 2. I have found that running qt on the pi is far to slow.

    I have searched for two days to find the right toolchain download for qt/raspberry and its corresponding qt configuration. Nothing seems to work. I have found what seems like a thousand dead ends searching the web. I can write and compile apps for windows console fine. But finding information to cross compile for raspberry seems to be an elusive Unicorn!

    Does anyone have this working??? If so which of the many toolchains did you use? And please help me replicate your Qt configuration. The closest I have come is using the GCC ARM Embedded toolchain but I cant seem to get the Qt options set correctly and I believe that only gets me part of the way there. My ultimate goal is to control GPIO and use the RadioHead library.

    Thanks in advance!

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

      Hi and welcome to devnet,

      That tutorial might be a good starting point although I'd recommend doing it from a Linux machine (virtual or not). Cross-compilation/debugging is easier from there.

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

      avgjoecoderA 1 Reply Last reply
      0
      • P Offline
        P Offline
        pushp_arya
        wrote on last edited by
        #3

        Hi,
        I also trying from past 4 days and unable to compile it on windows 7.
        I used the same tutorial as mentioned but is waste of time.
        even it is not compiling for Qt 5.6 too (for which tutorial has been made).

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          That tutorial might be a good starting point although I'd recommend doing it from a Linux machine (virtual or not). Cross-compilation/debugging is easier from there.

          avgjoecoderA Offline
          avgjoecoderA Offline
          avgjoecoder
          wrote on last edited by
          #4

          @SGaist

          I went through that post earlier but it is very light on detail. It appears that everything after step 3 is specific for compiling QT for the pi. I don't need to compile QT at all. Step 3 says install mingw which was installed by default with QT. So unfortunately that post seems to be of very little help to me unless I am missing something.

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

            Then there something not clear with your thread in that case. I've understood that you didn't want to build Qt on the Pi but cross-compile it so you could develop with it.

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

            avgjoecoderA 1 Reply Last reply
            0
            • SGaistS SGaist

              Then there something not clear with your thread in that case. I've understood that you didn't want to build Qt on the Pi but cross-compile it so you could develop with it.

              avgjoecoderA Offline
              avgjoecoderA Offline
              avgjoecoder
              wrote on last edited by
              #6

              @SGaist

              Host is windows 7 with QT already installed
              Target is raspberry

              My goal is to write/compile on windows then copy the result and run it on the pi.

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

                That ok, but what's not clear is whether you want to build a Qt application to run on your Pi.

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

                avgjoecoderA 1 Reply Last reply
                0
                • SGaistS SGaist

                  That ok, but what's not clear is whether you want to build a Qt application to run on your Pi.

                  avgjoecoderA Offline
                  avgjoecoderA Offline
                  avgjoecoder
                  wrote on last edited by
                  #8

                  @SGaist

                  I want to write a C++ app USING qt and run it on the pi.

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

                    In that case, you must first cross-compile Qt in order to build your application for the Pi.

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

                    avgjoecoderA 1 Reply Last reply
                    0
                    • avgjoecoderA avgjoecoder

                      @SGaist

                      I want to write a C++ app USING qt and run it on the pi.

                      avgjoecoderA Offline
                      avgjoecoderA Offline
                      avgjoecoder
                      wrote on last edited by
                      #10

                      @avgjoecoder

                      Or specifically write a C++ app using "QT Creator". QT Creator is already running on my win7 pc. The target for the C++ app is the pi.

                      1 Reply Last reply
                      0
                      • SGaistS SGaist

                        In that case, you must first cross-compile Qt in order to build your application for the Pi.

                        avgjoecoderA Offline
                        avgjoecoderA Offline
                        avgjoecoder
                        wrote on last edited by
                        #11

                        @SGaist

                        Why do I need to compile qt? I only want to run my c++ app on the pi, not QT. Why do I need qt on the pi at all?? I was under the impression that once you cross compile your c++ into a binary, you could simply copy it to the pi and run it. Shouldn't all of the dependencies be compiled into the binary? Perhaps that is a bad assumption?

                        jsulmJ 2 Replies Last reply
                        0
                        • avgjoecoderA avgjoecoder

                          @SGaist

                          Why do I need to compile qt? I only want to run my c++ app on the pi, not QT. Why do I need qt on the pi at all?? I was under the impression that once you cross compile your c++ into a binary, you could simply copy it to the pi and run it. Shouldn't all of the dependencies be compiled into the binary? Perhaps that is a bad assumption?

                          jsulmJ Online
                          jsulmJ Online
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @avgjoecoder You should use the correct wording to avoid misunderstandings!
                          "I want to write a C++ app USING qt and run it on the pi." - that means you want to use Qt for your application which will run on RPI. What you really mean is: "I want to use QtCreator to develop for RPI". Qt is not the same as QtCreator. If you only want to use QtCreator for developing and don't want to use Qt for your application then you do not have to compile Qt.

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • avgjoecoderA avgjoecoder

                            @SGaist

                            Why do I need to compile qt? I only want to run my c++ app on the pi, not QT. Why do I need qt on the pi at all?? I was under the impression that once you cross compile your c++ into a binary, you could simply copy it to the pi and run it. Shouldn't all of the dependencies be compiled into the binary? Perhaps that is a bad assumption?

                            jsulmJ Online
                            jsulmJ Online
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by jsulm
                            #13

                            @avgjoecoder "Shouldn't all of the dependencies be compiled into the binary? Perhaps that is a bad assumption?" - yes that is a bad assumption. It is simple: if your app is using a library (like any Qt library) - then you need that library for the target architecture/OS. That means if you want to use Qt for your RPI application you need Qt build for ARM/Linux (I guess you use Linux on RPI?), you cannot use Qt you installed on your Windows host because it is for x86/Windows.

                            "Shouldn't all of the dependencies be compiled into the binary?" - I guess with this you mean static linking? Even in this case you need all the libraries you're using built for the target CPU/OS. For static linking you need static libraries. Shared libraries are not compiled into the executable!

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            avgjoecoderA 1 Reply Last reply
                            1
                            • jsulmJ jsulm

                              @avgjoecoder "Shouldn't all of the dependencies be compiled into the binary? Perhaps that is a bad assumption?" - yes that is a bad assumption. It is simple: if your app is using a library (like any Qt library) - then you need that library for the target architecture/OS. That means if you want to use Qt for your RPI application you need Qt build for ARM/Linux (I guess you use Linux on RPI?), you cannot use Qt you installed on your Windows host because it is for x86/Windows.

                              "Shouldn't all of the dependencies be compiled into the binary?" - I guess with this you mean static linking? Even in this case you need all the libraries you're using built for the target CPU/OS. For static linking you need static libraries. Shared libraries are not compiled into the executable!

                              avgjoecoderA Offline
                              avgjoecoderA Offline
                              avgjoecoder
                              wrote on last edited by
                              #14

                              @jsulm

                              I am sure you know this better than I. I think I understand your confusion. You assumed that I wanted to use some of the QT libraries?? If so, that is not the case. Let's take a step back.

                              My first goal was to do what I thought would be simple. Use qtcreator on windows 7 to cross-compile a simple hello world app that runs on the pi. I don't want to include anything that would complicate this. I do not want to write/compile on the pi or use any more than is absolutely necessary to accomplish this first milestone.

                              Is that more clear?

                              jsulmJ 1 Reply Last reply
                              0
                              • avgjoecoderA avgjoecoder

                                @jsulm

                                I am sure you know this better than I. I think I understand your confusion. You assumed that I wanted to use some of the QT libraries?? If so, that is not the case. Let's take a step back.

                                My first goal was to do what I thought would be simple. Use qtcreator on windows 7 to cross-compile a simple hello world app that runs on the pi. I don't want to include anything that would complicate this. I do not want to write/compile on the pi or use any more than is absolutely necessary to accomplish this first milestone.

                                Is that more clear?

                                jsulmJ Online
                                jsulmJ Online
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                @avgjoecoder I understood you correctly (see again what I wrote before). You can use QtCreator as your IDE. You can cross compile on Windows for PI, but it is easier on Linux. I don't know how to do it on Windows, but there are sources on the internet.

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • avgjoecoderA Offline
                                  avgjoecoderA Offline
                                  avgjoecoder
                                  wrote on last edited by
                                  #16

                                  Looks like I'll have to give up on QT CReator for this. I was unable to find anything on the net that indicated success on Windows.

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • avgjoecoderA avgjoecoder

                                    Looks like I'll have to give up on QT CReator for this. I was unable to find anything on the net that indicated success on Windows.

                                    jsulmJ Online
                                    jsulmJ Online
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    @avgjoecoder The problem is not QtCreator. QtCreator is an IDE which needs an working environment to build software. In your case you need a compiler and a sysroot for the target hardware. If the sysroot is not there you will not be able to build even on the command line.
                                    I would suggest to install Linux in a virtual machine and do it there - it is much easier compared to Windows.

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    avgjoecoderA 1 Reply Last reply
                                    0
                                    • jsulmJ jsulm

                                      @avgjoecoder The problem is not QtCreator. QtCreator is an IDE which needs an working environment to build software. In your case you need a compiler and a sysroot for the target hardware. If the sysroot is not there you will not be able to build even on the command line.
                                      I would suggest to install Linux in a virtual machine and do it there - it is much easier compared to Windows.

                                      avgjoecoderA Offline
                                      avgjoecoderA Offline
                                      avgjoecoder
                                      wrote on last edited by
                                      #18

                                      @jsulm The problem is CONFIGURING QtCreator. Apparently no one here knows how to do that for windows to pi cross compile and debug. I gave up on QT and have succeeded to do just that with Eclipse, their suggested toolchain and detailed configuration docs. So for my purposes, no need to continue this thread.

                                      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