Qt - Cross Compiling - qt

I am doing a cross compiling [mips] of Qt and Qt based applications.
Two developement machines; one 64bit and other 32bit, are used for this purpose.
Generally Qt related libraries and binaries are cross compiled in 64 bit machine. Qt based application, is cross compiled in 32bit machine.
With this setup, there is a small problem with usage of moc/qmake/qrc etc; These are compiled on 64bit machine and cannot run on the 32bit machine.
One shortcut method, is to change the mkspec [Pass -m32 instead of -m64 in linux-g++-64 ].
This way issue is resolved.
What I wanted to know is, if we can configure Qt itself to use linux-g++-32 instead of 64, for compilation of qmake/moc etc binaries.

Try with -platform linux-g++-32 -xplatform your-mips-mkspec

Related

MPI with MinGW and Eclipse

My question is devided in two parts :
What is the best combination to execute MPI program in C language, when i searched for the necessary tools i found who work with Visual Studio and MS-MPI , and who work with Eclipse PTP or Code::Blocks and MPICH2 MPIOpen so i didn't know what to choose and what are tools that are compatible which other?
So ive installed OpenMPI,Eclipse PTP (Kepler) and MinGW-w64 to compile some C programs using MPI on windows 7 64Bits. i set all paths such as mpicc.exe i tried to test the Hello world program which is include with eclipse as example, i got this error:
13:03:48 **** Incremental Build of configuration Debug for project A ****
Info: Internal Builder is used for build
mpicc "-IC:\Program" Files "(x86)\OpenMPI_v1.6.2-x64\include" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\A.o" "..\src\A.c"
The Open MPI wrapper compiler was unable to find the specified compiler
cl.exe in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
13:03:48 Build Finished (took 115ms)
So i searched for cl.exe in my computer but i didn't found it, when i looked for some solution i found that the majority who solved this cl.exe problem are using visual studio, which is not my case so am little bit confused i dont want to switch to Visual Studio, so any solution with the tools that am using ?
OpenMPI does not appear to officially support MinGW as a backend: https://www.open-mpi.org/software/ompi/v1.6/ms-windows.php
The installers were configured with CMake 2.8.1 and compiled under Visual Studio 2010, and they support for C/C++ compilers of Visual Studio 2005, 2008 and 2010.
https://www.math.ucla.edu/~wotaoyin/windows_coding.html and other sources found on a search describe workflows using MS-MPI with MinGW. It may be a viable alternative. VSCode and MPI in WSL describes yet another non-paid but proprietary approach using VSCode with the WSL plugin.

Qt Static Linking not working without msvcrt.dll

Hello my problem is how to build qt application without need a msvcrt.dll
and builded a exe need msvcrt.dll how to fix? im trying build with /MT commandline argument but not working ineed make a full Standalone Qt application.
Thank you
The solution is to use ./configure -static -static-runtime for MSVC when building Qt. It will link the windows runtime libraries statically.
-static-runtime .... Statically link the C/C++ runtime library.
or you use MingW as your compiler. MingW will not have the typical windows runtime dependencies. There may be dependencies, but they are already available on every Windows system.
As far as I know -static-runtime is available somewhere from Qt 5.x

Deployment of statically linked Qt application backward compatibility

This is my first attempt at making a Qt Application work on different systems.
I have opted for static linking method.I have already compiled the sources of Qt 5.5 and compiled my application with the static Qt. The executable is working fine on my computer.
My operating system is Ubuntu 15.04. But when I tried to run the same executable on Ubuntu 14.04 then I ran into trouble. The key details of the error message are given below.
libstdc++.so.6 cxxabi_1.3.8 not found
I did a standard Google search and realised it was because I had a newer version of it on my machine, the machine where I had created the executable. There were so many different approaches to handle this problem. One of the solutions I saw involved shipping your own copy of libstdc++.so with the executable. But when I tried to copy the .so file to a pen drive, there was a warning saying that the file system does not support such files.
My question is , what am I doing wrong ? Also if I wanted to make the executable target Ubuntu 10.04, what would be the correct procedure handling the backward compatibility issues. I know that one method would be to install the same OS on my machine and then create the executable , is there any other way?
libstd++ is backward compatible but not forward compatible, which means you can run a program with a newer version of libstdc++ than the one you compiled it with but not vice-versa. This is what you experienced.
One way to deal with this issue is using older OS versions as the build machine. When you for example use Ubuntu 14.04 LTS, you'll get this list of compatible target systems.
The build system you're using will probably limit available compilers. On Ubuntu 14.04 you get GCC 4.8, which is good for most C++11 and packages for clang 3.6 are available, which will give you full C++14 support.
Targeting Ubuntu 10.04 will be challenging if you do not want to use a stone age compiler.
The idea of shipping libstdc++ will not help you much because you'll run into the same problem with libc.

Deploying Qt5.5 Qml App to Windows XP shows me a blank window?

I have built a static x86 Qt5.5 library with VS2013 using:
configure -static -prefix D:\Qt\qt-5.5.0-x86-static -opensource -release -static-runtime -nomake examples -no-compile-examples -static-runtime -nomake tools -no-iconv -qt-zlib -skip qtwebkit -confirm-license -qmake -opengl desktop -no-angle -nomake tests -target xp
After that I used this static library build a static-link exe of my Qml App. It can run everywhere in my windows which has been installed Qt5.5.
Then I used VMware Workstation to install a pure Windows XP SP3 only installed VC2008 runtime not VC2013 runtime.
Firstly, I copy the exe into this XP. It can run but had nothing to show. I need kill it in taskmgr.
Second, I copy all folders in D:\Qt\qt-5.5.0-x86-static\qml to the root dir of my exe, it can run. But it shows me only a blank window with correct window title.
I think I have listen all the advise in Deploying Qt 5 App on Windows. But why the qml parts cannot be compiled into static library? How can I let my app not show blank?
P.S. Even if I use windeployqt to deploy share-link library version of app. It also shows me blank window. But it can run on Windows 7.
The output of qtdiag on my virtual XP:
Qt 5.5.0 (i386-little_endian-ilp32 static release build; by MSVC 2013)
on "windo ws" OS: Windows XP [winnt version 5.1.2600]
Architecture: i386; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
Library info: PrefixPath: D:\Qt\qt-5.5.0-x86-static
DocumentationPath: D:\Qt\qt-5.5.0-x86-static\doc HeadersPath:
D:\Qt\qt-5.5.0-x86-static\include LibrariesPath:
D:\Qt\qt-5.5.0-x86-static\lib LibraryExecutablesPath:
D:\Qt\qt-5.5.0-x86-static\bin BinariesPath:
D:\Qt\qt-5.5.0-x86-static\bin PluginsPath:
D:\Qt\qt-5.5.0-x86-static\plugins ImportsPath:
D:\Qt\qt-5.5.0-x86-static\imports Qml2ImportsPath:
D:\Qt\qt-5.5.0-x86-static\qml ArchDataPath:
D:\Qt\qt-5.5.0-x86-static DataPath: D:\Qt\qt-5.5.0-x86-static
TranslationsPath: D:\Qt\qt-5.5.0-x86-static\translations
ExamplesPath: D:\Qt\qt-5.5.0-x86-static\examples TestsPath:
D:\Qt\qt-5.5.0-x86-static\tests SettingsPath:
Standard paths [... denote writable entry]: DesktopLocation:
"Desktop" *C:\Documents and Settings\Administrator\
The final conclusion:
The problem is the graphic driver in my virtual Windows XP. It can run on other real PCs.
But there is a sad problem to static build of QML.
I have found this:
https://forum.qt.io/topic/22035/qml-apps-not-runnable-using-static-build-up-to-qt-5-0-1-release/24
The reason why I need copy such folders Qt QtQuick.2 QtQuick is that those lib cannot be compile-loaded. Even if I add them into .pro file. From Qt 5.0 to Qt 5.5. The official side seems do not like people use QML by static-link. So, it is waste of time to do static build of QML app.
Qt Quick applications need 3d acceleration in order to work. This is based on either OpenGL, DirectX via Angle or some kind of software renderer that comes with the commercial version of Qt. Since you specifically exclude Angle in your config, you need a proper OpenGL driver. Make sure that OpenGL works on your machine. You'll find tools for that.
I don't think that is has something to do with missing C++ standard libraries (VC2013 runtime), because in this case your application would crash during start and not run. Qt Quick graphic issues however often lead to a running black app that is writing warnings to the console.
Further debugging can be done using the qtdiag.exe command line tool that comes with Qt (It comes with the online installer. I don't know where it is when you build from source). It checks for you which graphic driver is used and often can show error messages.

Qt Creator - setting up a kit with a cross-compiler

I'm attempting to use Qt creator to cross-compile a project, but have an issue matching the Qt version and my specified compiler toolchain.
I have created a Kit setting up a Device, selecting my toolchain as the compiler (GCC ARM Linux in this case), but I only have a locally installed system Qt (5.0.2 on Mint x86).
Qt Creator understandably tells me the compiler cannot produce code for the Qt version; all the guides I have found suggest using a Qt compiled for the target platform. This doesn't make sense though - it attempts to run qmake compiled for a different architecture and fails
How do I install or configure/compile a Qt version to work with the cross compiler? Maybe I can modify my existing one to understand this setup?
Thanks
This makes absolutely sense. The advice to use a Qt, which is compiled for your target platform is correct. But this does not mean that you use a Qt that was compiled natively on that target platform. You need to use a Qt, which was compiled with a special cross compiler on your host platform for your target platform. This way qmake and other build tools remain executable on your host, but create configurations for your target.
So, if you have a compiler, which can create ARM code, use it to build your Qt. Then you can create a kit in QtCreator out of this compiler/Qt pair.
Greenflow is right. I would like to add some information. I have cross compiled Qt 5.4.1 on Windows having an ARM Linux as target platform. You just need to configure the build properly. Here's what I did:
./configure -platform win32-g++ -xplatform linux-arm-gnueabihf-g++ .....
So Qt tools (qmake,moc,etc...) were built as Windows binaries and all the libraries were built as Linux binaries. Check for the available platforms in qtbase/mkspecs.

Resources