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



  • 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!


  • Lifetime Qt Champion

    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.



  • 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).



  • @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.


  • Lifetime Qt Champion

    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.



  • @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.


  • Lifetime Qt Champion

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



  • @SGaist

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


  • Lifetime Qt Champion

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



  • @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.



  • @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?


  • Moderators

    @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.


  • Moderators

    @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!



  • @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?


  • Moderators

    @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.



  • 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.


  • Moderators

    @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.



  • @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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.