I tried to build QT 5.11.1 for Android on Windows, and “configure.bat” completed successfully, but “mingw32-make” failed with with the following error:
No rule to make target 'vulkan/qvulkanfunctions_p.h', needed by '.obj\qvulkaninstance.obj'.
It is the bug fixed in QT 5.11.2 that is planned on August/September 2018.
When I build the master branch and copied the following files from it to \qtbase\src\gui\vulkan manually:
qvulkanfunctions.h qvulkanfunctions_p.cpp qvulkanfunctions_p.h
and started “mingw32-make” again I got another error:
C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -mthumb -Os -std=c++14 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_SERIALPORT_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_NO_EXCEPTIONS -I. -I. -I..\..\include -I..\..\include\QtSerialPort -I..\..\include\QtSerialPort\5.11.1 -I..\..\include\QtSerialPort\5.11.1\QtSerialPort -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1\QtCore -IE:\repos\qt5-11\qt5\qtbase\include -IE:\repos\qt5-11\qt5\qtbase\include\QtCore -I.moc -IE:\repos\qt5-11\qt5\qtbase\mkspecs\android-g++ -o .obj\qserialport_unix.obj qserialport_unix.cpp qserialport_unix.cpp:77:8: error: redefinition of 'struct termios2' struct termios2 { ^ In file included from C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/arm-linux-androideabi/asm/termbits.h:19:0, from C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/asm-generic/termios.h:21, from C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/arm-linux-androideabi/asm/termios.h:19, from C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/linux/termios.h:22, from C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/sys/ioctl.h:38, from C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/termios.h:32, from qserialport_p.h:69, from qserialport_unix.cpp:42: C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/asm-generic/termbits.h:34:8: error: previous definition of 'struct termios2' struct termios2 { ^ del libQt5NetworkAuth.so Could Not Find E:\repos\qt5-11\qt5\qtnetworkauth\src\oauth\libQt5NetworkAuth.so C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/platforms/android-16/arch-arm/ -Wl,--no-undefined -Wl,-z,origin -Wl,-rpath=\$ORIGIN -Wl,--no-undefined -Wl,-z,noexecstack -shared -Wl,-soname,libQt5NetworkAuth.so -o libQt5NetworkAuth.so .obj\qoauth1.obj .obj\qabstractoauth.obj .obj\qabstractoauth2.obj .obj\qoauth1signature.obj .obj\qoauthoobreplyhandler.obj .obj\qabstractoauthreplyhandler.obj .obj\qoauth2authorizationcodeflow.obj .obj\qoauthhttpserverreplyhandler.obj .obj\moc_qoauth1.obj .obj\moc_qabstractoauth.obj .obj\moc_qabstractoauth2.obj .obj\moc_qoauthoobreplyhandler.obj .obj\moc_qabstractoauthreplyhandler.obj .obj\moc_qoauth2authorizationcodeflow.obj .obj\moc_qoauthhttpserverreplyhandler.obj -LC:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/users/d-ef/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -LE:/repos/qt5-11/qt5/qtbase/lib -lQt5Network -lQt5Core -lgnustl_shared -lgcc -llog -lz -lm -ldl -lc mingw32-make.exe[3]: *** [Makefile:1130: .obj\qserialport_unix.obj] Error 1 mingw32-make.exe[3]: Leaving directory 'E:/repos/qt5-11/qt5/qtserialport/src/serialport' mingw32-make.exe[2]: *** [Makefile:45: sub-serialport-make_first] Error 2 mingw32-make.exe[2]: Leaving directory 'E:/repos/qt5-11/qt5/qtserialport/src' mingw32-make.exe[1]: *** [Makefile:47: sub-src-make_first] Error 2 mingw32-make.exe[1]: Leaving directory 'E:/repos/qt5-11/qt5/qtserialport' mingw32-make.exe: *** [Makefile:201: module-qtserialport-make_first] Error 2 mingw32-make.exe: *** Waiting for unfinished jobs.... del ..\..\lib\libQt5NetworkAuth.so Could Not Find E:\repos\qt5-11\qt5\qtnetworkauth\lib\libQt5NetworkAuth.so move libQt5NetworkAuth.so ..\..\lib\ 1 file(s) moved. mingw32-make.exe[3]: Leaving directory 'E:/repos/qt5-11/qt5/qtnetworkauth/src/oauth' mingw32-make.exe[2]: Leaving directory 'E:/repos/qt5-11/qt5/qtnetworkauth/src' mingw32-make.exe[1]: Leaving directory 'E:/repos/qt5-11/qt5/qtnetworkauth'
I added ‘-skip qtserialport’ option as a workaround, but got another error:
C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -mthumb -Os -std=c++14 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NO_EXCEPTIONS -I. -I..\..\..\3rdparty\libwebp -I..\..\..\3rdparty\libwebp\src -I..\..\..\3rdparty\libwebp\src\dec -I..\..\..\3rdparty\libwebp\src\enc -I..\..\..\3rdparty\libwebp\src\dsp -I..\..\..\3rdparty\libwebp\src\mux -I..\..\..\3rdparty\libwebp\src\utils -I..\..\..\3rdparty\libwebp\src\webp -IC:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle\sources\android\cpufeatures -IE:\repos\qt5-11\qt5\qtbase\include -IE:\repos\qt5-11\qt5\qtbase\include\QtGui -IE:\repos\qt5-11\qt5\qtbase\include\QtCore -I.moc -IE:\repos\qt5-11\qt5\qtbase\mkspecs\android-g++ -o .obj\main.obj main.cpp del libqwebp.so Could Not Find E:\repos\qt5-11\qt5\qtimageformats\src\plugins\imageformats\webp\libqwebp.so C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/platforms/android-16/arch-arm/ -Wl,--no-undefined -Wl,-z,origin -Wl,-rpath=\$ORIGIN/../../lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -Wl,-soname,libqwebp.so -o libqwebp.so .obj\alpha_processing_neon.obj .obj\dec_neon.obj .obj\enc_neon.obj .obj\filters_neon.obj .obj\lossless_enc_neon.obj .obj\lossless_neon.obj .obj\rescaler_neon.obj .obj\upsampling_neon.obj .obj\yuv_neon.obj .obj\main.obj .obj\qwebphandler.obj .obj\alpha_dec.obj .obj\buffer_dec.obj .obj\frame_dec.obj .obj\idec_dec.obj .obj\io_dec.obj .obj\quant_dec.obj .obj\tree_dec.obj .obj\vp8_dec.obj .obj\vp8l_dec.obj .obj\webp_dec.obj .obj\demux.obj .obj\anim_decode.obj .obj\alpha_processing.obj .obj\alpha_processing_mips_dsp_r2.obj .obj\alpha_processing_sse2.obj .obj\alpha_processing_sse41.obj .obj\cost.obj .obj\cost_mips32.obj .obj\cost_mips_dsp_r2.obj .obj\cost_sse2.obj .obj\cpu.obj .obj\dec.obj .obj\dec_clip_tables.obj .obj\dec_mips32.obj .obj\dec_mips_dsp_r2.obj .obj\dec_msa.obj .obj\dec_sse2.obj .obj\dec_sse41.obj .obj\enc.obj .obj\enc_avx2.obj .obj\enc_mips32.obj .obj\enc_mips_dsp_r2.obj .obj\enc_msa.obj .obj\enc_sse2.obj .obj\enc_sse41.obj .obj\filters.obj .obj\filters_mips_dsp_r2.obj .obj\filters_msa.obj .obj\filters_sse2.obj .obj\lossless.obj .obj\lossless_enc.obj .obj\lossless_enc_mips32.obj .obj\lossless_enc_mips_dsp_r2.obj .obj\lossless_enc_msa.obj .obj\lossless_enc_sse2.obj .obj\lossless_enc_sse41.obj .obj\lossless_mips_dsp_r2.obj .obj\rescaler.obj .obj\rescaler_mips32.obj .obj\rescaler_mips_dsp_r2.obj .obj\rescaler_msa.obj .obj\rescaler_sse2.obj .obj\ssim.obj .obj\ssim_sse2.obj .obj\upsampling.obj .obj\upsampling_mips_dsp_r2.obj .obj\upsampling_msa.obj .obj\upsampling_sse2.obj .obj\upsampling_sse41.obj .obj\yuv.obj .obj\yuv_mips_dsp_r2.obj .obj\lossless_sse2.obj .obj\yuv_mips32.obj .obj\yuv_sse2.obj .obj\yuv_sse41.obj .obj\alpha_enc.obj .obj\analysis_enc.obj .obj\backward_references_cost_enc.obj .obj\backward_references_enc.obj .obj\config_enc.obj .obj\cost_enc.obj .obj\filter_enc.obj .obj\frame_enc.obj .obj\histogram_enc.obj .obj\iterator_enc.obj .obj\near_lossless_enc.obj .obj\picture_enc.obj .obj\picture_csp_enc.obj .obj\picture_psnr_enc.obj .obj\picture_rescale_enc.obj .obj\picture_tools_enc.obj .obj\predictor_enc.obj .obj\quant_enc.obj .obj\syntax_enc.obj .obj\token_enc.obj .obj\tree_enc.obj .obj\vp8l_enc.obj .obj\webp_enc.obj .obj\anim_encode.obj .obj\muxedit.obj .obj\muxinternal.obj .obj\muxread.obj .obj\bit_reader_utils.obj .obj\bit_writer_utils.obj .obj\color_cache_utils.obj .obj\filters_utils.obj .obj\huffman_utils.obj .obj\huffman_encode_utils.obj .obj\quant_levels_utils.obj .obj\quant_levels_dec_utils.obj .obj\random_utils.obj .obj\rescaler_utils.obj .obj\thread_utils.obj .obj\utils.obj .obj\cpu-features.obj -LC:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/users/d-ef/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -LE:/repos/qt5-11/qt5/qtbase/lib -lQt5Gui -lQt5Core -lGLESv2 -lgnustl_shared -lgcc -llog -lz -lm -ldl -lc move libqwebp.so ..\..\..\..\plugins\imageformats\ 1 file(s) moved. mingw32-make.exe[5]: Leaving directory 'E:/repos/qt5-11/qt5/qtimageformats/src/plugins/imageformats/webp' mingw32-make.exe[4]: Leaving directory 'E:/repos/qt5-11/qt5/qtimageformats/src/plugins/imageformats' mingw32-make.exe[3]: Leaving directory 'E:/repos/qt5-11/qt5/qtimageformats/src/plugins' mingw32-make.exe[2]: Leaving directory 'E:/repos/qt5-11/qt5/qtimageformats/src' mingw32-make.exe[1]: Leaving directory 'E:/repos/qt5-11/qt5/qtimageformats'
and then I got another error:
C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -mthumb -Os -std=c++14 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_NO_FOREACH -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NO_EXCEPTIONS -I. -I..\..\..\..\include -I..\..\..\..\include\QtSvg -IE:\repos\qt5-11\qt5\qtbase\include -IE:\repos\qt5-11\qt5\qtbase\include\QtWidgets -IE:\repos\qt5-11\qt5\qtbase\include\QtGui\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtGui\5.11.1\QtGui -IE:\repos\qt5-11\qt5\qtbase\include\QtGui -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1\QtCore -IE:\repos\qt5-11\qt5\qtbase\include\QtCore -I.moc -IE:\repos\qt5-11\qt5\qtbase\mkspecs\android-g++ -o .obj\main.obj main.cpp del libqsvg.so Could Not Find E:\repos\qt5-11\qt5\qtsvg\src\plugins\imageformats\svg\libqsvg.so C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/platforms/android-16/arch-arm/ -Wl,--no-undefined -Wl,-z,origin -Wl,-rpath=\$ORIGIN/../../lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -Wl,-soname,libqsvg.so -o libqsvg.so .obj\main.obj .obj\qsvgiohandler.obj -LC:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/users/d-ef/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -LE:/repos/qt5-11/qt5/qtsvg/lib -lQt5Svg -LE:/repos/qt5-11/qt5/qtbase/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lgnustl_shared -lgcc -llog -lz -lm -ldl -lc move libqsvg.so ..\..\..\..\plugins\imageformats\ 1 file(s) moved. mingw32-make.exe[5]: Leaving directory 'E:/repos/qt5-11/qt5/qtsvg/src/plugins/imageformats/svg' mingw32-make.exe[4]: Leaving directory 'E:/repos/qt5-11/qt5/qtsvg/src/plugins/imageformats' del libqsvgicon.so Could Not Find E:\repos\qt5-11\qt5\qtsvg\src\plugins\iconengines\svgiconengine\libqsvgicon.so C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/platforms/android-16/arch-arm/ -Wl,--no-undefined -Wl,-z,origin -Wl,-rpath=\$ORIGIN/../../lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -Wl,-soname,libqsvgicon.so -o libqsvgicon.so .obj\main.obj .obj\qsvgiconengine.obj -LC:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/users/d-ef/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -LE:/repos/qt5-11/qt5/qtsvg/lib -lQt5Svg -LE:/repos/qt5-11/qt5/qtbase/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGLESv2 -lgnustl_shared -lgcc -llog -lz -lm -ldl -lc move libqsvgicon.so ..\..\..\..\plugins\iconengines\ 1 file(s) moved. mingw32-make.exe[5]: Leaving directory 'E:/repos/qt5-11/qt5/qtsvg/src/plugins/iconengines/svgiconengine' mingw32-make.exe[4]: Leaving directory 'E:/repos/qt5-11/qt5/qtsvg/src/plugins/iconengines' mingw32-make.exe[3]: Leaving directory 'E:/repos/qt5-11/qt5/qtsvg/src/plugins' mingw32-make.exe[2]: Leaving directory 'E:/repos/qt5-11/qt5/qtsvg/src' mingw32-make.exe[1]: Leaving directory 'E:/repos/qt5-11/qt5/qtsvg'
and even that error:
C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -mthumb -Os -std=c++14 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_NO_FOREACH -DQT_NO_USING_NAMESPACE -DQT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST -DYYLTYPE_IS_DECLARED=1 -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_XMLPATTERNS_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NO_EXCEPTIONS -I. -Iacceltree -Idata -Iapi -Ienvironment -Iexpr -Ifunctions -Iiterators -Ijanitors -Iparser -Ischema -Itype -Iutils -I..\..\include -I..\..\include\QtXmlPatterns -I..\..\include\QtXmlPatterns\5.11.1 -I..\..\include\QtXmlPatterns\5.11.1\QtXmlPatterns -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1\QtCore -IE:\repos\qt5-11\qt5\qtbase\include -IE:\repos\qt5-11\qt5\qtbase\include\QtNetwork -IE:\repos\qt5-11\qt5\qtbase\include\QtCore -I.moc -IE:\repos\qt5-11\qt5\qtbase\mkspecs\android-g++ -o .obj\qacceltree.obj acceltree\qacceltree.cpp In file included from ..\..\include\QtXmlPatterns\5.11.1\QtXmlPatterns/private/qpatternistlocale_p.h:1:0, from utils/qxpathhelper_p.h:55, from acceltree\qacceltree.cpp:51: ..\..\include\QtXmlPatterns\5.11.1\QtXmlPatterns/private/../../../../../src/xmlpatterns/utils/qpatternistlocale_p.h:275:2: error: #error "Patternist uses exceptions and cannot be built without." #error "Patternist uses exceptions and cannot be built without." ^ del libqwebp.so Could Not Find E:\repos\qt5-11\qt5\qtimageformats\src\plugins\imageformats\webp\libqwebp.so
and then this:
C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -DQT_MAPBOXGL_STATIC -g -g -mthumb -Os -std=c++14 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_LOCATION_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_POSITIONING_LIB -DQT_CONCURRENT_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I. -I..\..\..\3rdparty\mapbox-gl-native\platform\qt\include -I..\..\..\..\include\QtLocation\5.11.1 -I..\..\..\..\include\QtLocation\5.11.1\QtLocation -IE:\repos\qt5-11\qt5\qtdeclarative\include\QtQuick\5.11.1 -IE:\repos\qt5-11\qt5\qtdeclarative\include\QtQuick\5.11.1\QtQuick -IE:\repos\qt5-11\qt5\qtbase\include\QtGui\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtGui\5.11.1\QtGui -I..\..\..\..\include -I..\..\..\..\include\QtLocation -IE:\repos\qt5-11\qt5\qtdeclarative\include -IE:\repos\qt5-11\qt5\qtdeclarative\include\QtQuick -IE:\repos\qt5-11\qt5\qtbase\include -IE:\repos\qt5-11\qt5\qtbase\include\QtGui -IE:\repos\qt5-11\qt5\qtdeclarative\include\QtQml\5.11.1 -IE:\repos\qt5-11\qt5\qtdeclarative\include\QtQml\5.11.1\QtQml -I..\..\..\..\include\QtPositioning\5.11.1 -I..\..\..\..\include\QtPositioning\5.11.1\QtPositioning -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1\QtCore -IE:\repos\qt5-11\qt5\qtdeclarative\include\QtQml -IE:\repos\qt5-11\qt5\qtbase\include\QtNetwork -I..\..\..\..\include\QtPositioning -IE:\repos\qt5-11\qt5\qtbase\include\QtConcurrent -IE:\repos\qt5-11\qt5\qtbase\include\QtSql -IE:\repos\qt5-11\qt5\qtbase\include\QtCore -I.moc -IE:\repos\qt5-11\qt5\qtbase\mkspecs\android-g++ -o .obj\moc_qgeomapmapboxgl.obj .moc\moc_qgeomapmapboxgl.cpp del libqtgeoservices_mapboxgl.so Could Not Find E:\repos\qt5-11\qt5\qtlocation\src\plugins\geoservices\mapboxgl\libqtgeoservices_mapboxgl.so C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/platforms/android-16/arch-arm/ -Wl,--no-undefined -Wl,-z,origin -Wl,-rpath=\$ORIGIN/../../lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -Wl,-soname,libqtgeoservices_mapboxgl.so -o libqtgeoservices_mapboxgl.so .obj\qgeoserviceproviderpluginmapboxgl.obj .obj\qgeomappingmanagerenginemapboxgl.obj .obj\qgeomapmapboxgl.obj .obj\qmapboxglstylechange.obj .obj\qsgmapboxglnode.obj .obj\qrc_mapboxgl.obj .obj\moc_qgeoserviceproviderpluginmapboxgl.obj .obj\moc_qgeomappingmanagerenginemapboxgl.obj .obj\moc_qgeomapmapboxgl.obj -LC:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/users/d-ef/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -LE:/repos/qt5-11/qt5/qtlocation/lib -lQt5Location -LE:/repos/qt5-11/qt5/qtbase/lib -LE:/repos/qt5-11/qt5/qtdeclarative/lib -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Positioning -lQt5Concurrent -lQt5Sql -lQt5Core -lGLESv2 -lqmapboxgl -LC:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/users/d-ef/appdata/local/android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -LE:/repos/qt5-11/qt5/qtbase/lib -lQt5Network -lQt5Gui -lQt5Sql -lQt5Core -lGLESv2 -lgnustl_shared -lgcc -llog -lm -ldl -lc -lz move libqtgeoservices_mapboxgl.so ..\..\..\..\plugins\geoservices\ 1 file(s) moved. mingw32-make.exe[5]: Leaving directory 'E:/repos/qt5-11/qt5/qtlocation/src/plugins/geoservices/mapboxgl' mingw32-make.exe[4]: Leaving directory 'E:/repos/qt5-11/qt5/qtlocation/src/plugins/geoservices' mingw32-make.exe[3]: Leaving directory 'E:/repos/qt5-11/qt5/qtlocation/src/plugins' mingw32-make.exe[2]: Leaving directory 'E:/repos/qt5-11/qt5/qtlocation/src' mingw32-make.exe[1]: Leaving directory 'E:/repos/qt5-11/qt5/qtlocation'
and then this (possible solution):
C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -mthumb -Os -std=c++14 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_DECLARATIVE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_OPENTYPE -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DQT_XMLPATTERNS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_XMLPATTERNS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I..\..\include -I..\..\include\QtDeclarative -I..\..\include\QtDeclarative\5.8.0 -I..\..\include\QtDeclarative\5.8.0\QtDeclarative -Iqml -Iqml\parser -Iqml\rewriter -Iutil -Igraphicsitems -Idebugger -IE:\repos\qt5-11\qt5\qtbase\include\QtWidgets\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtWidgets\5.11.1\QtWidgets -IE:\repos\qt5-11\qt5\qtbase\include\QtGui\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtGui\5.11.1\QtGui -IE:\repos\qt5-11\qt5\qtscript\include\QtScript\5.11.1 -IE:\repos\qt5-11\qt5\qtscript\include\QtScript\5.11.1\QtScript -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1 -IE:\repos\qt5-11\qt5\qtbase\include\QtCore\5.11.1\QtCore -IE:\repos\qt5-11\qt5\qtbase\include -IE:\repos\qt5-11\qt5\qtbase\include\QtWidgets -IE:\repos\qt5-11\qt5\qtbase\include\QtGui -IE:\repos\qt5-11\qt5\qtscript\include -IE:\repos\qt5-11\qt5\qtscript\include\QtScript -IE:\repos\qt5-11\qt5\qtbase\include\QtSql -IE:\repos\qt5-11\qt5\qtxmlpatterns\include -IE:\repos\qt5-11\qt5\qtxmlpatterns\include\QtXmlPatterns -IE:\repos\qt5-11\qt5\qtbase\include\QtNetwork -IE:\repos\qt5-11\qt5\qtbase\include\QtCore -I.moc -IE:\repos\qt5-11\qt5\qtbase\mkspecs\android-g++ -o .obj\qdeclarativetextinput.obj graphicsitems\qdeclarativetextinput.cpp graphicsitems\qdeclarativetextinput.cpp: In member function 'void QDeclarativeTextInput::setCursorVisible(bool)': graphicsitems\qdeclarativetextinput.cpp:517:17: error: 'class QWidgetLineControl' has no member named 'setCursorBlinkPeriod' d->control->setCursorBlinkPeriod(on?QApplication::cursorFlashTime():0);
and then this:
javac -source 6 -target 6 -Xlint:unchecked -bootclasspath C:\Users\D-Ef\AppData\Local\Android\Sdk/platforms/android-27/android.jar -cp "E:\repos\qt5-11\qt5\qtlocation\src\plugins\position\android\jar\src;C:\Users\D-Ef\AppData\Local\Android\Sdk\platforms\android-27\android.jar" -d .classes src\org\qtproject\qt5\android\positioning\QtPositioning.java Note: src\org\qtproject\qt5\android\positioning\QtPositioning.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. del QtPositioning.jar Could Not Find E:\repos\qt5-11\qt5\qtlocation\src\plugins\position\android\jar\QtPositioning.jar
But finally I built it, below I provided the instruction:
Get QT sources (do not use –recursive option):
git clone https://code.qt.io/qt/qt5.git --branch 5.11.1 ./init-repository --branch --module-subset=essential,qtandroidextras,qtsvg,qtquickcontrols2,qtgraphicaleffects
and make it a bit better by adding vulkan files listed above to \qtbase\src\gui\vulkan (if you have version lesser than 5.11.2), and by removing “try { } catch (…) {}” surrounding the user code in qtbase\src\corelib\thread\qthread_unix.cpp or build with -DQT_NO_EXCEPTIONS.
void *QThreadPrivate::start(void *arg) { #if !defined(Q_OS_ANDROID) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); #endif pthread_cleanup_push(QThreadPrivate::finish, arg); #ifndef QT_NO_EXCEPTIONS try #endif { QThread *thr = reinterpret_cast<QThread *>(arg); QThreadData *data = QThreadData::get2(thr); { QMutexLocker locker(&thr->d_func()->mutex); // do we need to reset the thread priority? if (int(thr->d_func()->priority) & ThreadPriorityResetFlag) { thr->d_func()->setPriority(QThread::Priority(thr->d_func()->priority & ~ThreadPriorityResetFlag)); } data->threadId.store(to_HANDLE(pthread_self())); set_thread_data(data); data->ref(); data->quitNow = thr->d_func()->exited; } if (data->eventDispatcher.load()) // custom event dispatcher set? data->eventDispatcher.load()->startingUp(); else createEventDispatcher(data); #if (defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_QNX)) { // sets the name of the current thread. QString objectName = thr->objectName(); pthread_t thread_id = from_HANDLE<pthread_t>(data->threadId.load()); if (Q_LIKELY(objectName.isEmpty())) setCurrentThreadName(thread_id, thr->metaObject()->className()); else setCurrentThreadName(thread_id, objectName.toLocal8Bit()); } #endif emit thr->started(QThread::QPrivateSignal()); #if !defined(Q_OS_ANDROID) pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_testcancel(); #endif thr->run(); } #ifndef QT_NO_EXCEPTIONS #ifdef __GLIBCXX__ // POSIX thread cancellation under glibc is implemented by throwing an exception // of this type. Do what libstdc++ is doing and handle it specially in order not to // abort the application if user's code calls a cancellation function. catch (const abi::__forced_unwind &) { throw; } #endif // __GLIBCXX__ catch (...) { qTerminate(); } #endif // QT_NO_EXCEPTIONS // This pop runs finish() below. It's outside the try/catch (and has its // own try/catch) to prevent finish() to be run in case an exception is // thrown. pthread_cleanup_pop(1); return 0; }
Set up the environment on Windows 10 as follows:
- Install Android Studio with SDK and NDK, install NDK API Level 19.
- Install Python (needed by QtQML).
- Install Strawberry Perl first and then MinGW 64 bit to C:\PFiles
- Run the command file provided below in QT root directory containing configure.bat.
- Run “mingw32-make.exe -j2” and then “mingw32-make install“
set PATH=C:\PFiles\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin;%PATH% set PATH=%PATH%;C:\Program Files\Android\Android Studio\jre\bin set PATH=%PATH%;C:\PFiles\Python35 rem Check if the tools are in PATH where gcc where mingw32-make.exe where perl.exe where javac.exe set "ANDROID_TARGET_ARCH=armeabi-v7a" rem see ANDROID_SDK_ROOT\build-tools\ folder set "ANDROID_BUILD_TOOLS_REVISION=27.0.3" rem The same values as in QT Creator: set "ANDROID_API_VERSION=android-19" set "ANDROID_SDK_ROOT=C:\Users\D-Ef\AppData\Local\Android\Sdk" set "ANDROID_NDK_PATH=C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle" set "ANDROID_NDK_PLATFORM=android-19" set "ANDROID_TOOLCHAIN_VERSION=4.9" set "ANDROID_NDK_HOST=windows-x86_64" rem QT_NO_EXCEPTIONS disables "try { } catch (...) {}" surrounding the user code in qthread_unix.cpp configure.bat -prefix C:\Qt\Qt5.11-Android -DQT_NO_EXCEPTIONS -release -force-debug-info -platform win32-g++ -opengl es2 -xplatform android-g++ -android-ndk %ANDROID_NDK_PATH% -android-sdk %ANDROID_SDK_ROOT% -opensource -confirm-license -nomake tests -nomake examples -skip qtserialport -skip qtquick1 -skip qtxmlpatterns -skip webengine -skip websockets -skip webchannel -skip qt3d -skip charts -skip connectivity -skip datavis3d -skip doc -skip gamepad -skip location -skip sensors -skip serialbus -skip purchasing -skip wayland rem mingw32-make.exe -j2
alternatively it can be (for x86)
... rem see ANDROID_SDK_ROOT\build-tools\ folder set "ANDROID_BUILD_TOOLS_REVISION=27.0.3" rem The same values as in QT Creator: set "ANDROID_API_VERSION=android-19" configure.bat -prefix C:\Qt\Qt5.11-x86 -DQT_NO_EXCEPTIONS -release -shared -force-debug-info -platform win32-g++ -opengl es2 -xplatform android-g++ -opensource -confirm-license -nomake tests -nomake examples^ -android-ndk C:\Users\D-Ef\AppData\Local\Android\Sdk\ndk-bundle -android-sdk C:\Users\D-Ef\AppData\Local\Android\Sdk -android-ndk-platform android-19 -android-ndk-host windows-x86_64 -android-arch x86 -android-toolchain-version 4.9^ -skip qtserialport -skip qtquick1 -skip qtxmlpatterns -skip webengine -skip websockets -skip webchannel -skip qt3d -skip charts -skip connectivity -skip datavis3d -skip doc -skip gamepad -skip location -skip sensors -skip serialbus -skip purchasing -skip wayland rem mingw32-make.exe -j2
it outputs:
Configure summary: Building on: win32-g++ (i386, CPU features: mmx sse sse2 sse3 ssse3) Building for: android-g++ (i386, CPU features: mmx sse sse2 sse3 ssse3) Configuration: cross_compile sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512cd avx512er avx512pf compile_examples f16c force_debug_info rdrnd shani x86SimdAlways shared rpath release c++11 c++14 concurrent no-pkg-config reduce_exports reduce_relocations stl
If QT is built with “-skip quickcontrols” the app does not start reporting the following error:
W MyApp : (null):0 ((null)): QQmlApplicationEngine failed to load component W MyApp : (null):0 ((null)): qrc:/main.qml:4 module "QtQuick.Dialogs" is not installed
because there is no Dialogs folder in qml\QtQuick.
Links:
- QT configure options.
- The list of 3rd party libraries like harfbuzz.
- QT supports Android 4.1, 5, 6, 7, 8 (armv7, x86) API Level 16.
- Another compiler error.
- Building Qt for ARM and x86.
- Android Codenames, Tags, and Build Numbers.
My QML Android app compiled with this version of QT worked fine on Android 6. But on Android 4.4 it did not start, because it was unable to load “QtQuick” module, see the logs:
backtrace: #00 pc 00021e20 /system/lib/libc.so (tgkill+12) #01 pc 00012ea9 /system/lib/libc.so (pthread_kill+48) #02 pc 000130bd /system/lib/libc.so (raise+10) #03 pc 00011df3 /system/lib/libc.so #04 pc 000216d4 /system/lib/libc.so (abort+4) #05 pc 000781a7 /data/app-lib/net.geographx.LinesGame-1/libQt5Core.so (QMessageLogger::fatal(char const*, ...) const+50) ... 07-13 04:41:28.360 2903 2916 D dalvikvm: Trying to load lib /data/app-lib/net.geographx.LinesGame-1/libLinesGameQt.so 0xa5d8b308 07-13 04:41:28.540 2903 2916 D : (null):0 ((null)): QML debugging is enabled. Only use this in a safe environment. 07-13 04:41:28.550 2903 2916 D dalvikvm: Added shared lib /data/app-lib/net.geographx.LinesGame-1/libLinesGameQt.so 0xa5d8b308 07-13 04:41:28.550 2903 2916 D dalvikvm: No JNI_OnLoad found in /data/app-lib/net.geographx.LinesGame-1/libLinesGameQt.so 0xa5d8b308, skipping init 07-13 04:41:28.640 2903 2916 V SysInfo : DisplayMetrics Width: 2464, Height: 1600, Pixel Ratio: 2.222222, densityDpi: 320, scaledDensity: 2.000000, xdpi: 320.000000, ydpi: 320.000000, density: 2.000000 07-13 04:41:29.360 2903 2916 D libLinesGameQt.so: ..\LinesGameQt\main.cpp:58 (int main(int, char**)): Translation file has been loaded successfully: "LinesGame_en" 07-13 04:41:29.360 2903 2916 D Lines : ..\LinesGameQt\main.cpp:86 (int main(int, char**)): App version: "2.1.38" 07-13 04:41:29.540 2903 2916 D Lines : ..\LinesGameQt\main.cpp:108 (int main(int, char**)): QT/SysInfo: Device Pixel Ratio: 4.44444 Screen DPI: 71.8969 07-13 04:41:29.660 2903 2916 W Lines : (null):0 ((null)): QQmlApplicationEngine failed to load component 07-13 04:41:29.660 2903 2916 W Lines : (null):0 ((null)): qrc:/main.qml:1 plugin cannot be loaded for module "QtQuick": Cannot load library /data/data/net.geographx.LinesGame/qt-reserved-files/qml/QtQuick.2/libqtquick2plugin.so: (dlopen failed: invalid flags to dlopen: 1001) 07-13 04:41:29.670 2903 2916 F Lines : C:\Qt\Qt5.11-Android\include/QtCore/qlist.h:345 ((null)): ASSERT: "!isEmpty()" in file C:\Qt\Qt5.11-Android\include/QtCore/qlist.h, line 345 07-13 04:41:29.670 2903 2916 F libc : Fatal signal 6 (SIGABRT) at 0x00000b57 (code=-6), thread 2916 (qtMainLoopThrea)
A quick Google search gave this:
- API level 23 (v6.0, marshmellow) and higher are aware of all flags. (api level 19 (v4.4, kitkat) and lower are not aware of both RTLD_NOLOAD nor RTLD_NODELETE, api level 22 (v5.1, lollipop) and lower are not aware of RTLD_NODELETE), #define RTLD_NODELETE 0x01000
- Android: plugin cannot be loaded for module “QtQuick”: dlopen failed: invalid flags to dlopen: 1001.
These flags are defined in Android\Sdk\ndk-bundle\sysroot\usr\include\dlfcn.h as follows:
#define RTLD_LOCAL 0 #define RTLD_LAZY 0x00001 #define RTLD_NOW 0x00002 #define RTLD_NOLOAD 0x00004 #define RTLD_GLOBAL 0x00100 #define RTLD_NODELETE 0x01000
and there is the following in qt5\qtbase\src\corelib\plugin\qlibrary_unix.cpp:
bool QLibraryPrivate::load_sys() { QString attempt; QFileSystemEntry fsEntry(fileName); ... int dlFlags = 0; int loadHints = this->loadHints(); if (loadHints & QLibrary::ResolveAllSymbolsHint) { dlFlags |= RTLD_NOW; } else { dlFlags |= RTLD_LAZY; } ... // Provide access to RTLD_NODELETE flag on Unix // From GNU documentation on RTLD_NODELETE: // Do not unload the library during dlclose(). Consequently, the // library's specific static variables are not reinitialized if the // library is reloaded with dlopen() at a later time. #ifdef RTLD_NODELETE if (loadHints & QLibrary::PreventUnloadHint) { dlFlags |= RTLD_NODELETE; } #endif ... if (!pHnd) { errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror()); } if (pHnd) { qualifiedFileName = attempt; errorString.clear(); } return (pHnd != 0); }
so looks like dlopen function is called with RTLD_LAZY | RTLD_NODELETE.
The source file qtbase/src/corelib/plugin/qlibrary_unix.cpp did not change since 2016 year:
git diff 6caace33b451966400ef068e1205e5c2356a781c 32eee8f17a24305ddf33e9ca5821f4cdaa1483cd qtbase/src/corelib/plugin/qlibrary_unix.cpp
so I simply commented RTLD_NODELETE out in qtbase/src/corelib/plugin/qlibrary_unix.cpp:
#ifdef RTLD_NODELETE //if (loadHints & QLibrary::PreventUnloadHint) { // dlFlags |= RTLD_NODELETE; //} #endif
and recompiled libQt5Core.so, so the app started fine on Android 4.4.
Probably it does not relate to the QT version, but I noticed that there is a strange device “Pixel 2” where the app started in 26 seconds:
before there was no “Pixel 2” device in Google Auto-tests:
Also I built QT with old version of Android NDK, Revision 13b (October 2016) that has separate includes for each API level.
I used android-ndk-r10e and android-ndk-r13b.