Using Qt Creator to Cross Compilation for Non-Qt Projects - qt

I use qt creator for cross compilation non-qt projects.But I built qt-everywhere for arm to generate qmake because I couldn't use default qmake(for Desktop) for arm.
Is there any way cross compiling non-qt project without building qt-everywhere?

It sounds like you built Qt to develop on and target the ARM, not develop on a Host and target the ARM board. Building Qt to develop on the ARM will create qmake and other tools for the ARM. Building Qt to develop on the Host and target (run) on the arm will create the Qt build tools for the Host and the Qt runtimes for the ARM.
The secret is to add -hostprefix <hostdir> to the configure line. This specifies where to place the host side build tools (moc, uic, qmake) on the Host.
You can find a complete list of the options for configure by running configure --help.

Related

setting up VS platfrom toolset in QtCreator

I have a project based on Qt which use QWebEngine. For compiling this project i've installed Visual Studio Express 2015 and have configured kits. My project is built, all is fine. But now i need to compile my project for Windows XP platform. I know, that for doing this it is needed to change toolset from v140 to v140_xp.
How can i set the toolset from qtcreator?
I tried to determine the difference in compiler options in both cases. For doing that I've created test project in Visual Studio. There i change the toolset and look at Project Properties -> C/C++ -> Command Line Options. But seems that nothing changes there.
Qt WebEngine module does not support Windows XP targeting, so this won't work anyway. Even if it did, you'd need to build a copy of Qt that targets Windows XP - otherwise your application will target Windows XP, but not the Qt library it uses, and it won't work that way.
For completeness sake, here's how you'd do it assuming that you got Qt built targeting Windows XP:
There only two ways to do it currently without patching Qt Creator itself:
Execute Qt Creator with environment variables already setup up for the XP toolset enabled for command line use. I.e. target XP from command line, and launch Qt Creator from there.
Add relevant environment variable settings to the Build environment of the project in Qt Creator.
The details of environment variables needed to target Windows XP are given e.g. here.
For Windows XP portability, you should be using the semi-maintained for of the qtwebkit module. It builds and works on XP, and works with most recent Qt IIRC.
Note: It's certainly possible to target XP using WebEngine and Angle, but it requires lots of patches to current Qt. It's not an insignificant effort, and you'd definitely want to test it on the graphics cards that you intend to target - the DirectX 9 drivers on some of those machines are buggy, and while the code is correct and compiles and runs, it may not work on some systems. I'd say that it's absolutely not worth the effort.
In VS there is an editbin utility, which could be used as follows
editbin file.exe /SUBSYSTEM:WINDOWS,5.01 /OSVERSION:5.1

Can't run Qt application under UWP kit

My app is Qt Quick Controls 2 based app. Qt 5.7.1, Windows 10, Visual Studio 2015.
Desktop 32bit version works fine.
But when I switch to Qt 5.7.1 for Universal Windows Platform 32bit kit, it fails to run with the following error:
winrtrunner --device 0 --start --stop --install --wait 0 --profile appx C:/Work/Source/build-MusicPlayer-Qt_5_7_1_for_Universal_Windows_Platform_32bit-Release/bin/player.exe
qt.winrtrunner: Using the Appx profile.
qt.winrtrunner: Failed to activate application: 0x8027025b "The app didn't start."
Error while executing the WinRT Runner Tool: Process crashed
It states here that some dependency is missing. I've checked it using Dependency Walker and it seems that all the required DLLs are in the application's folder. I've also tried to copy just all the files from Qt kit installation into app's dir.
My application consists of one main executable and three .DLL files. I've launched windeployqt for the each of them. Tried both debug and release versions.
I have the same problem on Windows 10, Qt 5.8 (also 5.7), Windows Runtime 64bit VC2015.
This topic was opened on Qt website here: https://forum.qt.io/topic/73272/qt-5-7-for-winrt-and-dynamic-libraries, but it did not help in my case :(. I opened a new topic here: https://forum.qt.io/topic/75424/cannot-start-qt-quick-winrt-application
I had same issue.
You need to recompile all static / dynamic libraries that your application uses for Windows 10 SDK. The issue is that you need to use WinRT dll's which provide sandbox environment instead of "normal" Windows libraries. Windows Store applications require that.
In my case I was using zip static library (zlibstat.lib) with Quazip static library (quazip.lib), compiled in Windows 7 with Visual Studio 2012.
Instead, I used Qt zip, as Qt provides zip library inside QtCore.dll, (just use #include instead of #include "zlib.h") and recompiled Quazip as a static library for Windows 10 SDK.

TeamCity build agent with multiple version of Qt

We have the TeamCity build cloud with several computers and one of the computer runs on Linux with Qt install. We have several Qt projects and these project use different versions of Qt. For example:
project1 -> needs Qt 4.3
project2 -> needs Qt 5.0
project3 -> needs Qt 5.2
It would be nice to build all these project on this computer (build agent).
Is it possible somehow to make such build agent compatible to multiple Qt versions? How to configure Qt and TeamCity in such way?
Aproach 1
You can configure your teamcity project to run on specific teamcity agents . For ex
project1 -> teamcity-agent-qt4.3
project2 -> teamcity-agent-qt
project3 -> teamcity-agent-qt5.2
You can then configure Teamcity Agent startup properties for each agent to run on the specific qt version
Approach 2
In case you have a mechanism to dynamically source a qt version at runtime, you can add a parameter for the qt path in the build parameters section of the project and use that to run with the appropriate qt version in the build.

Profiler for Qt Creator + msvc compiler

How to profile a Qt program using Qt creator with msvc compiler?
To the best of my knowledge, there is no integrated equivalent to valgrind in QtCreator for Windows.
On the other hand, you can use a stand-alone application like very sleepy, which supports any native Windows app. It just attaches to a running process and lets you analyze the captured data through the functions of the process. It has been useful to me for finding performance bottlenecks in QtCreator applications that needed to be compiled with MSVC.

Qt cross-platform development?

I just have a little question about running Qt created apps on different operating systems.
As a normal user do i have to install Qt framework to run Qt apps ?
I mean i've created Qt app using Windows , then i made a build for Linux .
Do i need to install the Qt framework on the Linux pc inorder to run that app ?
Or there is a way to package all the needed libraries into the app installer .
Best Regards
You can deliver the dynamic libs you need with your application, as it's described here:
http://doc.qt.io/qt-5/deployment.html
Since Qt is not a system library, it has to be redistributed along
with your application; the minimum is to redistribute the run-time of
the libraries used by the application. Using static linking, however,
the Qt run-time is compiled into the executable.
Depends what you mean by 'framework', you will need the runtime libraries, unless you paid Nokia for a license to allow static linking.
For Linux, I think you would generally ensure that the Qt packages have been installed during installation (i.e. make them a requirement of the package you provide). Under Mac OS you would need to package the .so (shared objects) with your application. Under Windows you do the same (provide the .dlls) and install them with the application (not in the system folders).
The issue with static linking that #cbamber85 is alluding to, is the conformance with the LGPL licence where it's legal to link to the libraries at runtime but not at compile time (i.e. use the .so/.dll but not the .a files).

Resources