Compile Qt5 without GUI support on Linux ARM - c++

I'm having troubles getting Qt5 working without GUI elements on my Cortex-A9 board due the OpenGL dependencies (i.e. OpenGL ES2). I am running a Ubuntu 14.04 rootfs.
Is there any way to disable the generation of GUI classes, starting from git repository? (Target version 5.3).
The only modules I need are QtCore, QtXML and QtWebSockets/QtNetwork

The following seems to get Qt5 to compile with a LinuxFB driver and no OpenGL.
./configure -qpa linuxfb -no-largefile -opensource -verbose -release \
-no-accessibility -confirm-license -no-sse -no-sse2 \
-qt-zlib -qt-libpng -nomake examples -nomake demos -nomake docs -nomake tests \
-make libs --prefix=/usr -no-pch -no-iconv -no-nis -no-xkb -no-xshape \
-no-xvideo -no-xsync -no-xinerama -no-xcursor -no-xfixes -no-xrandr -no-kms \
-no-directfb -no-eglfs -no-xcb -no-dbus -no-icu -no-cups -no-gif \
-no-accessibility -no-opengl -nomake quick -make quick1 \
-skip multimedia -skip webkit -nomake webkit -no-pkg-config \
-no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci \
-no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 \
-no-sql-sqlite_symbian -no-sql-tds -nomake tools \
-device linux-custom-g++ -device-option CROSS_COMPILE=$TGT_TOOL_NAME-
The keys are, -no-opengl and -nomake quick. QtQuick2 will pull in OpenGL.
Also it seems I must do the following,
touch module_qtwebkit-make_first
This stops the build system from trying to make QtWebKit; it seems buggy. This still has the GUI classes, but don't link to them. That is before the plain make. For the install target,
touch module_qtwebkit-install_subtargets
was required. Later Qt5 releases may have fixed the QtWebkit build issues.

It seems that at least Qt 5.6.2 supports -no-gui and -no-widgets configuration options.

Ubuntu team itself declared that Qt5.3. is still under investigation for armhf platforms and that probably it will be available from 14.10 release.
Somehow, crawling on Qt forums, there are missing dependencies and compiling errors when there's no OpenGL/GUI module.
I resolved it installing 1t 5.2.1 from repositories and then the missing QWebSocket module from git repository.
In order to make this module compatible with older Qt version, the file .qmake.conf:
MODULE_VERSION = 5.3.2 --> to desired one (i.e. 5.2.1)

Related

How to build Qt 6.2.2 from source on Windows 10

I've been trying to build Qt 6.2.2 from source. I downloaded the sources package from the online installer but it fails each time, each time with a different error. I've tried a variety of configurations such as:
configure.bat -static -release -platform win32-msvc -opensource -confirm-license -prefix "C:\Qt\6.2.2\Static" -make libs -make tools -nomake examples -nomake tests
configure.bat -static -release -platform win32-msvc -opensource -confirm-license -prefix "C:\Qt\6.2.2\Static" -make libs -make tools -nomake examples -nomake tests -no-icu -no-opengl -no-openssl -skip qtwayland -skip qtquick3d -skip qtquickcontrols2 -skip qtquicktimeline -skip qtshadertools -skip qtdeclarative -skip qtdoc -skip qttranslations -skip qt3d -skip qt5compat -skip qtcharts -skip qtcoap -skip qtdatavis3d -skip qtlottie -skip qtmqtt -skip qtopcua -skip qtscxml -skip qtvirtualkeyboard -skip qtmultimedia -skip qtwebengine -skip qtwebview
configure.bat -static -release -platform win32-msvc -opensource -confirm-license -prefix "C:\Qt\6.2.2\Static" -no-openssl -make libs -make tools -nomake examples -nomake tests
I've tried using x86_x64 Cross Tools Command Prompt for VS 2017, x86_x64 Cross Tools Command Prompt for VS 2019,
and x64 Native Tools Command Prompt for VS 2019
Here is one of the errors I've gotten using all config options then cmake --build .
[1424/8836] Building CXX object
qtbase\src\network\CMakeFiles\Network.dir\Network_autogen\mocs_compilation.cpp.obj
FAILED:
qtbase/src/network/CMakeFiles/Network.dir/Network_autogen/mocs_compilation.cpp.obj
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1424~1.283\bin\Hostx86\x64\cl.exe
/nologo /TP -DQT_ASCII_CAST_WARNINGS -DQT_BUILDING_QT -DQT_BUILD_NETWORK_LIB -
DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -
DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_MOC_COMPAT -DQT_NO_CAST_TO_ASCII -
DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -
DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_USING_NAMESPACE -
DQT_USE_QSTRINGBUILDER -DQT_USE_SYSTEM_PROXIES -DUNICODE -DWIN32 -DWIN64 -
D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -
D_USE_MATH_DEFINES -D_WIN64 -
IC:\Qt\6.2.2\Src\qtbase\src\network\Network_autogen\include -
IC:\Qt\6.2.2\Src\qtbase\include -IC:\Qt\6.2.2\Src\qtbase\include\QtNetwork -
IC:\Qt\6.2.2\Src\qtbase\src\network -IC:\Qt\6.2.2\Src\qtbase\src\network\kernel -
IC:\Qt\6.2.2\Src\qtbase\include\QtNetwork\6.2.2 -
IC:\Qt\6.2.2\Src\qtbase\include\QtNetwork\6.2.2\QtNetwork -
IC:\Qt\6.2.2\Src\qtbase\src\network\..\3rdparty\zlib\src -
IC:\Qt\6.2.2\Src\qtbase\include\QtCore -IC:\Qt\6.2.2\Src\qtbase\mkspecs\win32-msvc -
IC:\Qt\6.2.2\Src\qtbase\src\corelib -IC:\Qt\6.2.2\Src\qtbase\include\QtCore\6.2.2 -
IC:\Qt\6.2.2\Src\qtbase\include\QtCore\6.2.2\QtCore -IC:\Strawberry\c\include /DWIN32
/D_WINDOWS /DNDEBUG -O2 -MD /W3 /wd4530 /wd4577 -Zc:__cplusplus -permissive- -utf-8 -
FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding
-Zc:externConstexpr -Zc:wchar_t -guard:cf -std:c++17
/YuC:/Qt/6.2.2/Src/qtbase/src/network/CMakeFiles/Network.dir/cmake_pch.hxx
/FpC:/Qt/6.2.2/Src/qtbase/src/network/CMakeFiles/Network.dir/./cmake_pch.cxx.pch
/FIC:/Qt/6.2.2/Src/qtbase/src/network/CMakeFiles/Network.dir/cmake_pch.hxx
/showIncludes
/Foqtbase\src\network\CMakeFiles\Network.dir\Network_autogen\mocs_compilation.cpp.obj
/Fdqtbase\lib\Qt6Network.pdb /FS -c
C:\Qt\6.2.2\Src\qtbase\src\network\Network_autogen\mocs_compilation.cpp
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1764): error C2027:
use of undefined type 'QSslCipherPrivate'
C:\Qt\6.2.2\Src\qtbase\include\QtNetwork\../../src/network/ssl/qsslcipher.h(56):
note: see declaration of 'QSslCipherPrivate'
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1763): note: while
compiling class template member function 'void
std::default_delete<QSslCipherPrivate>::operator ()(_Ty *) noexcept const'
with
[
_Ty=QSslCipherPrivate
]
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1873): note: see
reference to function template instantiation 'void
std::default_delete<QSslCipherPrivate>::operator ()(_Ty *) noexcept const' being
compiled
with
[
_Ty=QSslCipherPrivate
]
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1802): note: see
reference to class template instantiation 'std::default_delete<QSslCipherPrivate>'
being compiled
C:\Qt\6.2.2\Src\qtbase\include\QtNetwork\../../src/network/ssl/qsslcipher.h(87):
note: see reference to class template instantiation
'std::unique_ptr<QSslCipherPrivate,std::default_delete<QSslCipherPrivate>>' being
compiled
C:\Qt\6.2.2\Src\qtbase\include\QtCore\../../src/corelib/kernel/qmetatype.h(2168):
note: see reference to class template instantiation 'std::array<char,38>' being
compiled
C:\Qt\6.2.2\Src\qtbase\src\network\access\qnetworkaccesscache_p.h(127): note: see
reference to function template instantiation 'std::array<char,38>
QtPrivate::typenameHelper<QNetworkAccessCache::CacheableObject*>(void)' being
compiled
C:\Qt\6.2.2\Src\qtbase\include\QtCore\../../src/corelib/kernel/qmetatype.h(2168):
note: see reference to class template instantiation 'std::array<char,28>' being
compiled
C:\Qt\6.2.2\Src\qtbase\include\QtNetwork\../../src/network/access/
qnetworkreply.h(197):
note: see reference to function template instantiation 'std::array<char,28>
QtPrivate::typenameHelper<QNetworkReply::NetworkError>(void)' being compiled
C:\Qt\6.2.2\Src\qtbase\include\QtCore\../../src/corelib/kernel/qmetatype.h(2168):
note:
see reference to class template instantiation 'std::array<char,31>' being compiled
C:\Qt\6.2.2\Src\qtbase\include\QtNetwork\../../src/network/ssl/
qsslpresharedkeyauthentica
tor.h(94): note: see reference to function template instantiation
'std::array<char,31>
QtPrivate::typenameHelper<QSslPreSharedKeyAuthenticator*>(void)' being compiled
C:\Qt\6.2.2\Src\qtbase\include\QtCore\../../src/corelib/kernel/qmetatype.h(2376):
note:
see reference to class template instantiation 'std::array<char,30>' being compiled
C:\Qt\6.2.2\Src\qtbase\include\QtCore\../../src/corelib/kernel/qmetatype.h(1587):
note:
see reference to class template instantiation 'std::array<char,9>' being compiled
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1764): error C2338:
can't
delete an incomplete type
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\memory(1765): warning C4150:
deletion of pointer to incomplete type 'QSslCipherPrivate'; no destructor called
C:\Qt\6.2.2\Src\qtbase\include\QtNetwork\../../src/network/ssl/qsslcipher.h(56):
note:
see declaration of 'QSslCipherPrivate'
[1426/8836] Building CXX object
qtbase\src\tools\qvkgen\CMakeFiles\qvkgen.dir\qvkgen.cpp.obj
ninja: build stopped: subcommand failed.
I've also downloaded the 5.15.x source from here which I'm able to build without issues using the first configure command I posted.
I currently have Strawberry Perl 5.32.x, python 3.10, 3.9.x, and Cmake 3.22.1 installed they're all in my path as well. Per this I meet the requirements. I confirmed the path is correct using where <insert_name.exe> which returns:
where perl.exe
C:\Strawberry\perl\bin\perl.exe
where python.exe
C:\Users\MyNAme\AppData\Local\Programs\Python\Python39\python.exe
C:\Users\MyName\AppData\Local\Programs\Python\Python310\python.exe
where cmake.exe
C:\Program Files\CMake\bin\cmake.exe
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe
As I was writing this I kept digging and found a ton of bug reports about this same issue. It seems to all come back to OpenSSL. I grabbed the OpenSSL source, I installed NASM and added it to my path. I configured and built OpenSSL with:
perl Configure VC-WIN64A
nmake all
Once OpenSSL finished reconfigured Qt with it:
configure.bat -prefix "C:\Libraries\QT-Static" -release -platform win32-msvc -opensource -confirm-license -make libs -make tools -nomake examples -nomake tests -I "C:\Program Files\OpenSSL\include\openssl" -L "C:\Program Files\OpenSSL\lib"
This time it shows the following:
Qt Network:
getifaddrs() ........................... no
IPv6 ifname ............................ no
libproxy ............................... no
Schannel ............................... yes
OpenSSL ................................ yes
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ yes
DTLS ................................... yes
OCSP-stapling .......................... yes
SCTP ................................... no
Use system proxies ..................... yes
GSSAPI ................................. no
Brotli Decompression Support ........... no
Then ran:
cmake --build . --parallel
It still fails but this time with a lot more errors, once again linking back to the OpenSSL issue. I thought maybe it had to do with the CMAKE_CXX_STANDARD flag so I forced 17 instead of allowing MSVC to force latest but no luck. Has anyone managed to get 6.2.2 to build on windows 10, if so how?
Upgrade your compiler to the latest VS2019 version (16.11) - see also https://bugreports.qt.io/browse/QTBUG-97999

QT migration 5.9 to 5.10 cameraviewfinder broken

Environment A: cross-compiling on Ubuntu to Raspberry pi3 in source dir
~/src/rpi2point/qt-everywhere-opensource-src-5.9.0-rc2$ ~/src/rpi2point/qt-everywhere-opensource-src-5.9.0-rc2/configure -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=~/src/rpi2point/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/src/rpi2point/sysroot -opensource -confirm-license -make libs -no-use-gold-linker -no-pch -prefix /usr/local/qt5pi -extprefix ~/src/rpi2point/qt5pi -hostprefix ~/src/rpi2point/qt5 -v
QML Video Shader Effect and QML Video Example working
Camera Example throws:
/home/matin/src/rpi2point/sysroot/usr/lib/arm-linux-gnueabihf/libQt5OpenGL.so.5:-1: error: undefined reference to `operator delete(void*, unsigned int)#CXXABI_1.3.9'
/home/matin/src/rpi2point/sysroot/usr/lib/arm-linux-gnueabihf/libQt5OpenGL.so.5:-1: error: undefined reference to `qTriangulate(QVectorPath const&, QTransform const&, double)#Qt_5_PRIVATE_API'
Environment B: cross-compiling on Ubuntu to Raspberry pi3 in source dir
mkdir qt5.10
git clone https://github.com/qt/qt5.git
./init-repository
./configure -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=~/src/rpi2point/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/src/rpi2point/sysroot -opensource -confirm-license -make libs -no-use-gold-linker -no-pch -prefix /usr/local/qt5pi -extprefix ~/src/rpi2point/qt5pi -hostprefix ~/src/rpi2point/qt5 -v
Reconfigure QtCreator with additional device and building for qt 5.10 - the examples compile and run -- but no picture from the camera
any sugestions?
THX Martin

qmake-generated Makefile for win32-g++ platform contains unix commands

I'm trying to build a cross-compiler with Qt 5.4.1 to generate Raspberry Pi executables from a Windows 8.1 64-bit machine.
I'm using mingw64 and a gcc 4.9 cross-compiler for the Pi on the Windows machine and I am using the Qt 5.4.1 source. PATH points to the mingw64 binaries, the gcc 4.9 cross-compiler binaries, perl binaries, and %windir%\system32.
I use the following command to build the Qt cross-compiler:
configure.bat -platform win32-g++ -opengl es2 -device linux-rasp-pi-g++ \
-device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot \dev\qtxc\sysroot \
-opensource -confirm-license -release -make libs -prefix d:\dev\qtxc \
-platform win32-g++ -xplatform linux-arm-gnueabi-g++
Everything works fine until the very end when I get a few error messages containing Unix commands (again, I'm on a Windows machine in a Windows command prompt):
Running configuration tests...
process_begin: CreateProcess(NULL, rm -f arch.obj, ...) failed.
make (e=2): The file cannot be found
(...)
Then when I look at the generated Makefile, I can see that it erroneously defines Unix commands instead of Windows commands:
# Makefile for building: qt
# Generated by qmake (3.0) (Qt 5.4.1)
# Project: qt.pro
# Template: subdirs
# Command: D:\dev\qtxc\qtbase\bin\qmake -o Makefile qt.pro
MAKEFILE = Makefile
first: make_first
QMAKE = D:\dev\qtxc\qtbase\bin\qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
(...)
Then, of course, when I try to run mingw32-make as instructed in the output from the configure command, I get error messages related to the Unix commands that don't exist in Windows:
module-qtbase-qmake_all: FORCE
#test -d qtbase\ || mkdir -p qtbase\
cd qtbase\ && $(QMAKE) D:\dev\qtxc\qtbase\qtbase.pro -o Makefile
cd qtbase\ && $(MAKE) -f Makefile qmake_all
(#test doesn't work in Windows, of course).
I have tried modifying the qtbase\mkspecs\win32-g++\qmake.conf file to remove the Unix conditional definitions (seems like nonsense to have those in the win32 file anyway), forcing the definition of QMAKE_SH or QMAKE_OS_WIN32, to no avail.
Any suggestions?
I had the very same problem myself while setting up a Gitlab-CI runner to compile a Qt project on windows.
Using the -d (debug) option on qmake (see Running qmake) I discovered that qmake looks for sh in PATH and then determines which command set to use by setting QMAKE_SH.
If you seach for QMAKE_SH in the debug output of qmake bottom up, you should find the line where qmake makes the above described decision. In case sh was found, searching further up will take you to the line where the actual path to sh is printed out.
Mine was found in the path to Git for Windows (<path to git>\bin), since there is a 'sh.exe' in the bin folder next to git.exe.
I found two solutions for my particular case:
Temporarily add the unix tools to the PATH. In Git for Windows 2.5.3 they are located in <path to git>\usr\bin.
Temporarily remove the path to sh from PATH. You can do this by issuing SET PATH=%PATH:<path to remove>;=% to the command line.

Compiling QT 5.3.2 under windows 7 and msvc

I'm using msvc 2013 (ultimate-64bit), windows 7 64bit.
I compiled icu4c 54.1 by msvc 2013 (64 bit).
And now i try to compile qt 5.3.2-everywhere-opensource-src ( i added patch there (i replaced QWebFrame.cpp))
I used CMD developer tool from visual studio.
--- And i executed these commands:
cd D:\qt
d:
configure -prefix D:\Qt\Qt_making -platform win32-msvc2013 -opensource -c++11 -make tools -make libs -qt-sql-sqlite -no-openssl -icu -I C:\icu-53.1-vs2013\include -L C:\icu-53.1-vs2013\lib64 // all OK - after all, include loaded/ new icu libs loaded
nmake
After 4 command the process interrupted. And displayed error:
with: 36 unresolved externals these 'unresolved externals' is propably about libs.
I make screen of these errors (below):
So whats wrong?
I have to compile QT (in particular QWebKit - becouse of the patch all on 64 bit.)
The last time I compiled Qt for Windows (in order to get the desktop version of OpenGL), here's what I needed to do. Note that this was with VS2010 and Qt 5.0.0 (on Windows 7).
set CL=/MP
if not compiling qtwebkit:
Need to rename/delete the qtwebkit* directories (there's a -no-webkit option but it doesn't work in 5.0.0)
else:
Need ICU, GNU bison, and GNU gperf (either install the prebuilt binaries or build yourself)
if using ICU (required for qtwebkit):
set LIB=%LIB%;C:\icu\lib
set INCLUDE=%INCLUDE%;C:\icu\include
set PATH=C:\icu\bin;%PATH%
set PATH=%PATH%;C:\Program Files (x86)\gperf\bin;C:\bison\bin
cd <path>\qt-everywhere-opensource-src-<version>
configure -prefix C:\Qt\Qt5.0.0-opengl-desktop -opensource -debug-and-release -platform win32-msvc2010 -opengl desktop -no-cetest -nomake tests -nomake examples -confirm-license -ltcg -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -mp
nmake
nmake install
if used ICU:
copy all the DLLs from C:\icu\bin to C:\Qt\Qt5.0.0-opengl-desktop\bin

64bit Qt build on WIndows

I’m trying to build 64bit Qt 5.2.0 from source with Visual Studio 2013. I configure the build with the following options:
configure.bat -c++11 -no-angle -opengl desktop -nomake examples -opensource -nomake tests -confirm-license
Then I simply run nmake.
Unfortunately, the build stops almost immediately with the following error:
SOME_PATH\5.2.0-src\qtbase\src\corelib\codecs\qutfcodec.cpp : fatal error C1083: Cannot open compiler generated file: '.obj\release\qutfcodec.obj': No such file or directory
32bit builds work ok. Did anyone encounter such behavior?