Using VCPKG with cmake and Qt 6 for Windows ARM64 - c++

Qt 6.2 introduced Windows on Arm support (https://bugreports.qt.io/browse/QTBUG-85820). I tried to create a new cmake project set up using Qt Creator and everything works fine. Then I wanted to add some external packages to my project using vcpkg. The standard way to use vcpkg with cmake is using the CMAKE_TOOLCHAIN_FILE variable (as mentioned here. However, when I clicked on project settings in Qt Creator (Projects > Build) it seems that Qt Creator has already set up the CMAKE_TOOLCHAIN_FILE variable to another file
Presumably, this is done so that it is possible to cross-compile an ARM64 binary from a x64 machine. However, this prevents me from setting up vcpkg within my Qt project. Is there a way to get around this issue? Does CMake support multiple toolchain files or is there an alternative setup for my scenario?

I found out that VCPKG provides a way to achieve this as explained here:
To use an external toolchain file with a project using vcpkg, you can set the cmake variable VCPKG_CHAINLOAD_TOOLCHAIN_FILE on the configure line:
cmake ../my/project \
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=../my/project/compiler-settings-toolchain.cmake
So in my case, I can just qt toolchain file using VCPKG_CHAINLOAD_TOOLCHAIN_FILE option.

Related

CMake: Qt Project to CLion with MSVC 2017

I'm having a project in Qt Creator and I'm trying to port it into CLion but I found myself blocked into some problems. If any of you could help me to port this CMake project I would really appreciate it.
Qt Creator
So, here is my setup for the Qt Creator project first:
Qt: 5.14.2
Compiler: MSVC 2017 64-bits
Also, here are my custom paths and my build environment:
Also, the build (install) time in Qt Creator takes around 20-30minutes.
CLion
Now in terms of CLion and what I've tried here are the following.
and in terms of setting up the CMake:
I've also added the paths into Environment Variables from CLion
But the problem arises when I'm trying to compile the project.
I'm going to install the project via Build -> Install
After that, I need to wait for around 1h or more(even if in Qt Creator is going to take just 20-30min) to a point where the build will fail and I will receive the following error message
MASM : fatal error A1000: cannot open file : 4 [C:\PRJOJECT_NAME\build_clion\components\extern_crashpad\crashpad\util\crashpad_util.vcxproj]
but if I'm searching for that file, it exists in that folder which is specified. But the problem is that I don't understand why the same project if build with Qt Creator is working but not vice versa. Could any of you help me to understand what I'm doing wrong?
It looks like QT Creator is using Ninja as a generator and CLion is using MSVC.
Try -G Ninja in your CLion CMake Options text box. Make sure Ninja is in a path accessible by CMake.

Make - Internal compiler Error under QT 5.14.2 "Q_CORE_EXPORT"

I just installed QT Creator with QT under Win10 to build an already existing project. (Under Ubuntu everything went fine running the Make file). I'm not an expert for QT therefore I'm not able to find out how to resolve the error:
C:\Qt\5.14.2\mingw73_64\include/QtCore/qfloat16.h:102:54: internal compiler error: in make_rtl_for_nonlocal_decl, at cp/decl.c:6590
Q_CORE_EXPORT static const quint32 mantissatable[];
My gcc version is 8.3.0 (x86_64-posix-seh, Built by strawberryperl.com project). Is there something missing or broken in the installation?
On windows, you generally need to have a Qt which was built with the same (or compatible, but that can be hard to verify) compiler and relevant build options, as what you are using to build your application.
I doubt you will find a pre-built Qt SDK for that version of gcc, so if you want to use it, you should build Qt from sources. It can be a bit tedious on Windows, there are a fewf prerequisites you have to get etc. I recommend you use the Qt online installer to install a MinGW version of Qt SDK, and matching version of MinGW (also offered by the Qt installer.
I just found out from qmake.stash, that the included script for creating the make file always referenced a false path for the gcc compiler. I therefore build i manually with the QT Creator and it worked as expected. So I guess the fault was due to different paths for gcc in the environmental variables.
Here is the bug, there is a link to the patch: https://github.com/msys2/MINGW-packages/issues/5006
Also you can just downgrade to mingw gcc 8.2.0

How to create CMake cross-compiling toolchain for VxWorks?

I want to generate vxworks 6.x makefiles and workspace via CMake, and there is no support for VxWroks in CMake. How do I create a relevant generator for my platform anf the correct toolchain?
I'm new to CMake. I managed to create some test project that generate for windows VS 2015 and Ubuntu.
I tried to create one for VxWorks 6.x with GNU and DIAB compiler, but there is no support for it in CMake.
I read about something called toolchain, cross-compiling and platform files (.cmake) but I don't understand how to write it and where to put it.
I saw many examples in the internet but didn't understand if I need to rebuild the CMake with the new platform files or just reference to them form the toolchain or from CMakeLists.
I'm using the gui version of CMake 3.14.
I setting the generator as: Eclipse CDT4 - Unix Makefiles.
When I choosing the option of cross-compiling and provide name VxWorks, version, c++ compiler (gnu/4.1.2-vxworks-6.6/x86-win32/bin/c++ppc.exe), it write that the compiler is unknown and that I need to create Platform/VxWroks. It cannot build a simple test program.
I saw some post of someone who succeeded to create all required files :
Do (Cross-compile) platform files require an include guard?
But I couldn't download some examples to test it and a tutorial of how to do it.
I would like to be able to cgreate a generator with CMake for VxWorks 6.x to cimpile libraries and exacutable (.vxe) but don't know what to do.
CMake is not well supported in VxWorks 6, but CMake is supported from the Workbench/Eclipse GUI environment in VxWorks 7. Neither version supports command line cmake, e.g. "cmake ."

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.

Qt with Eclipse CDT Juno

I am having a difficult time trying to find a way to link the Qt library to my Eclipse project.
The Qt SDK package 4.8.1
with
Eclipse CDT Juno
Is there a way to link Qt libraries to eclipse?
UPDATE: It appears that the Eclipse plugin is no longer officially supported but that it's still available via download. The link below references their ftp site.
Nokia provides Eclipse-Qt integration. That said, it's unnecessary as it's always possible to use an Eclipse project that's using custom build commands. You could simply create a makefile project making certain to run qmake at the appropriate times.
To start, it might be as simple as:
Create a file or two
qmake -project # create your project file
qmake # generate your makefile
# tell eclipse to build the project
If the above, you'd only need to re-run qmake when adding new files and doing other things that affect the qt project file.
#enobayram
Yes it does.
The Qt integration pack is 32bit and therefore all depencies like Eclipse / Java / Qt must be also 32bit.