Setup Qt on windows 7 to cross compile for Raspberry Pi 2
-
That ok, but what's not clear is whether you want to build a Qt application to run on your Pi.
-
That ok, but what's not clear is whether you want to build a Qt application to run on your Pi.
I want to write a C++ app USING qt and run it on the pi.
-
In that case, you must first cross-compile Qt in order to build your application for the Pi.
-
I want to write a C++ app USING qt and run it on the pi.
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.
-
In that case, you must first cross-compile Qt in order to build your application for the Pi.
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?
-
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?
@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. -
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?
@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!
-
@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!
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?
-
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?
@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.
-
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.
@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. -
@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.