Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Building QT 6 for Android on Windows from sources



  • Tried to build QT for Android on Windows according to this: https://doc-snapshots.qt.io/qt6-dev/android-building.html

    But did not figure out

    1. what is the difference between "-prefix <\path\to\install>" and "-qt-host-path <path_to_host_qt_installation>" "configure.bat" parameters
    2. how to specify -DQT_NO_EXCEPTIONS as "configure.bat" parameter

    Tried the following:

    set "MY_INSTALL_PATH=E:\Qt\Qt6.0.2\android"
    set QT_HOST_PATH=%MY_INSTALL_PATH%

    rem QT_NO_EXCEPTIONS disables "try { } catch (...) {}" surrounding the user code in qthread_unix.cpp
    configure.bat -prefix %MY_INSTALL_PATH% -qt-host-path %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 -release -force-debug-info -platform win32-g++ -opengl es2 -xplatform android-clang ^
      -android-ndk %ANDROID_NDK_PATH% -android-sdk %ANDROID_SDK_ROOT% -android-abis arm64-v8a -android-ndk-host windows-x86_64 ^
      -opensource -confirm-license -nomake tests -nomake examples
    

    but got:

    Configuring 'qtbase'
    -- Android NDK detected: C://Users//D-Ef//AppData//Local//Android//Sdk/ndk-bundle
    -- Android toolchain file detected
    CMake Error at qtbase/cmake/QtSetup.cmake:173 (message):
      You need to set QT_HOST_PATH to cross compile Qt.
    Call Stack (most recent call first):
      qtbase/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:173 (include)
      qtbase/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:271 (qt_build_internals_set_up_private_api)
      qtbase/CMakeLists.txt:57 (qt_build_repo_begin)
    
    -- Configuring incomplete, errors occurred!
    
    1. where should I set QT_HOST_PATH?
    2. how to clean the configuration (after executing configure.bat with wrong parameters)?


  • 1.b https://www.qt.io/blog/qt-6-build-system seems to contain some information on this.

    The QT_HOST_PATH is to be set by using the -qt-host-path switch.

    To cross-build Qt, you need to point to an already existing native build of your host platform. This is called the host Qt.



  • @xtofl yes, I see, but what is QT_HOST_PATH?

    And why am I getting the error

    You need to set QT_HOST_PATH to cross compile Qt
    

    if I set it with -qt-host-path?


Log in to reply