Linux --> Windows CrossCompilation Error with QT Creator - c++

I want to do a cross compilation on Linux for a Windows use.
I have download the compiler MinGW for C++ on my VM, I tried to set it up as a Kit, and here's the error I have :
Error: The compiler "MinGW (C++, ×86 64bit at /usr/bin/×86_64-w64-mingw32-g++)" (x86-windows-msys-pe-64bit) cannot produce code for the Qt version "Qt 6.4.1 GCC 64bit" (x86-linux-generic-elf-64bit).
Do I have to download an other version of MinGW? Which one then?
Thanks a lot !

I had the same issue on Arch. I think this "warning" is a bug. I just ignore that fact, and try build app. I wasn't get any errors, even was try to open output .exe in Windows and don't notice any issue.

Related

How to make Qt Creator use Rosetta and x86 compiler on Mac M1?

I am using Qt 5.15.2 on my Mac mini with M1 chip. This works fine (due to Rosetta). Below is the list of compilers Qt Creator found on this computer, and among them is the C++, x86 64bit that I use. No problem.
I would like to use the same settings on a (somewhat newer) Mac Book Pro (also with M1 chip). Below is the list of compilers Qt Creator finds on this computer, the x86 is now missing!
I do not know if I have a x86 compiler on the new M1-computer. I have installed Xcode and the command line tools for XCode 13.2.
Can I somewhere tell Qt Creator that the deployment target is x86?
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
if not, how can I find out if there is an x86 compiler on my new M1-computer?
If the compiler is missing, how to install it?
Any help would be most appreciated!
A few tips that can help, I just setup a project using Qt 5.15.2 on a 2021 M1 Mac.
Note this will likely be different for Qt >= 6.
Can I somewhere tell Qt Creator that the deployment target is x86?
Yes, you can do this using specific argument in the build settings of your kit.
Add the QMAKE_APPLE_DEVICE_ARCHS="x86_64" additional argument to qmake.
Also, add an additional CMake option: -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64"
ℹ️ Click Manage Kits.. in the projects view to open the preferences editor where you can update your CMake configuration.
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
With rosetta installed (/usr/sbin/softwareupdate –install-rosetta –agree-to-license), and the configuration above, yes you can compile and link x86 binaries.

Module cpp could not be loaded in qbs

Im trying to compile my project using the clang compiler with Qbs on Windows 10 x64. I configured the tool using the QtCreator interface, and the error Module cpp could not be loaded appeared.
This is my configuration:
What is happening?
The message appears because no matching cpp module backend was found for the combination of clang toolchain and Windows target. I think the only compilers currently supported for Windows are MSVC and mingw.
Do you actually intend to create Windows binaries with clang?

QT enable cross-compiling using MinGW (precompiled)

Good day all
I have been searching for a method of cross-compiling for QT-Creator in Linux for sometime now, and I have been having alot of trouble with it.
Background info
please note: I am on a Linux machine, and would like to cross compile Windows Apps
My system:
Ubuntu Gnome 16.10
QT Creator 4.0.2 (based on QT 5.7)
I have came across a few SO links, a few blogs with broken instructions, etc and one seeming helpful but dependencies could not be found.
I have also attempted another compiler MXE and cloned and attempted to build the MXE compiler from the GIT repo, which failed (no solution for the build error - VTK build error)
I decided to download precompiled MinGW compilers (i686 and x86_x64 versions) from sourceforge
Issue:
In QT Creator, adding the compiler is done without an issue, adding the "Kit" and selecting the newly added compiler, an red exclamation gives an error
The Compiler (x86_windows_msys_pe_64bit) cannot produce code for QT version 5.7.0 GCC 64Bit (x86_linux_generic_elf_64bit)
This occurs for both 32 + 64 bit compilers.
I think that you should have a QT version that matches your compiler ABI. The error tells you that the MinGW compiler doesn't match the Linux version of QT you have used. Therefore, get a windows version of QT and use it instead (just as you've added WinGW).
You can download Qt Binaries from here.

How to compile LibQxt for qt5?

I am having problems compiling LibQxt for qt 5. http://dev.libqxt.org/libqxt/src
There are commits that says "Port Libqxt to Qt5". The project says to use configure-premake but it gives the error that there is no premake for windows but in the premake folder there is a file called premake.exe with the commit "Port LibQxt to Qt5" so i guess they added the option to compile for qt5 on windows but did not update the bash script? Anyone had any luck compiling libqxt for qt5 on windows with visual c++ 2010 and would like to share with me how?
Thanks
This is a bug.
Building libqxt on Windows with Qt5
Is still open.
I'v managed to compile the tip on Windows with Qt 5.2.1. Don't know about newer Qt versions, though.

Setting Qt Creator to use the latest version of g++ and gdb on Windows

I wish to use the C++11 features in a Qt programs compiled by GNU C++ compiler (MinGW) on Windows. By this reason I can not use a version of compiler provided in Qt SDK.
I decided to use the latest versions of Qt, Qt Creator and MinGW. By this reason, I download and install these software separately. It is easy to set up the Qt Creator to use the version of Qt installed in C:\Qt folder and GNU C++ compiler from MinGW installed to C:\MinGW folder, but a debugging does not work then. More specific, I receive error:
"During startup program exited with code 0x0"
How to fix it? What is a correct setting for the debugger in the toolchain options?
QtCreator requires a patched version of gdb to works. It's a workaround
To make the --tty option work under MinGW and
To prevent gdb from freezing when attaching to a suspended process.
You have 2 alternatives (assuming that you are entirely satisfied with the prior installation of the framework and the compiler):
Download the patched gdb binary from Qt's repository or
Download the patches from Qt's site, apply them and build gdb
Install the debugger to the appropriate directory and finally resume the configuration of the debugger.