Cross-compiling a Qt application for Red Hat 7.4 on Windows 10
-
I have a Qt application for windows, but now I need to cross-compile this application for Red Hat 7.
I know very little about cross-compiling in general, so I've been doing some research and I saw that you can use the Visual Studio IDE on Windows to create, edit, and debug a C++ project for Linux by having a remote connection to a Linux system, a virtual machine that runs Linux, or a Windows Subsystem for Linux. Unfortunately, our cyber security policies are very strict, so we are not allowed to use any of the three methods previously mentioned. It needs to be done strictly from win10 machine.
I saw on Qt's website that you can build Qt 5 from the source package and configure it according to your target platform. This is what I have so far:
configure -prefix C:\Qt\Qt-5.12.6-Static-Linux\ -release -static -no-compile-examples -platform win32-g++ -xplatform linux-g++-64 -recheck-all -vI tried running this and I got an error about not finding the target architecture binaries.
Do I need to add -device and -device-option CROSS_COMPILE=? If so, what values do I give them?
Also, what development toolchain can I use to build Qt for Redhat 7?
-
Hi and welcome to devnet,
You first have to install a proper cross-compiler to do that.
If memory serves well, you might be able to leverage cygwin for that (but that is from old memories...)
Another possible option could be to use your CI system to build the application for that target.
-
Hi and welcome to devnet,
You first have to install a proper cross-compiler to do that.
If memory serves well, you might be able to leverage cygwin for that (but that is from old memories...)
Another possible option could be to use your CI system to build the application for that target.
@SGaist I have Cygwin64 installed at
C:\cygwin64\How do I fit cygwin into the Qt configure command from my first question?
or
Do I need to run the cygwin terminal, navigate to my project directory and compile my source files from there? If so, does cygwin need to have a linux version of Qt within it?
What is the right approach?
I obviously have no clue what is and how Cygwin works; I'll start doing some reading on it.
-
It's going to be a bit more complicated than that.
You will first have to build a cross-compiler in order to build from Windows to Linux. There's a Cygwin mkspec that you may be able to leverage once you have the cross-compiler. Note that you may have to cross-compile Qt itself as well as the other dependencies of your application.
On side note, I haven't used Cygwin for ages so I might not be able to help you as much as I would like.