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

Qt-6.2.0: You need to set QT_HOST_PATH to cross compile Qt.



  • Hello!
    According to https://www.qt.io/blog/qt-6-build-system I can use QT_BUILD_TOOLS_WHEN_CROSS_COMPILING for build host tools during cross-compile, I try this and unfortunately this is not work

    ./configure .... \
        -- \
        -DCMAKE_TOOLCHAIN_FILE=$(BUILD_DIR)/toolchain.cmake \
        -DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON
    

    Follow console output

    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /tmp/firmware/toolchain/gcc-linaro-11.0.1-2021.03-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    CMake Error at cmake/QtSetup.cmake:196 (message):
      You need to set QT_HOST_PATH to cross compile Qt.
    Call Stack (most recent call first):
      cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:229 (include)
      cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:372 (qt_build_internals_set_up_private_api)
      CMakeLists.txt:91 (qt_build_repo_begin)
    
    
    -- Configuring incomplete, errors occurred!
    

    Why and how can I fix this?
    Thank you.


  • Lifetime Qt Champion

    @debian said in Qt-6.2.0: You need to set QT_HOST_PATH to cross compile Qt.:

    Why and how can I fix this?

    You need to do what the error message suggests.
    See https://doc.qt.io/qt-6/cmake-variable-qt-host-path.html



  • @jsulm , you mean what https://www.qt.io/blog/qt-6-build-system incorrect and QT_BUILD_TOOLS_WHEN_CROSS_COMPILING is not work? QT_BUILD_TOOLS_WHEN_CROSS_COMPILING is a useless if I have prebuilded host-Qt, this is mean what I should buld of Qt two time.


  • Lifetime Qt Champion

    @debian said in Qt-6.2.0: You need to set QT_HOST_PATH to cross compile Qt.:

    you mean

    No, that's not what I mean. I think you need to set QT_HOST_PATH in addition to QT_BUILD_TOOLS_WHEN_CROSS_COMPILING.



  • I was try use -qt-host-path, but this is now work at this is case

    ...............
    CMake Error at cmake/QtSetup.cmake:201 (find_package):
      Could not find a package configuration file provided by "Qt6HostInfo" with
      any of the following names:
    
        Qt6HostInfoConfig.cmake
        qt6hostinfo-config.cmake
    
      Add the installation prefix of "Qt6HostInfo" to CMAKE_PREFIX_PATH or set
      "Qt6HostInfo_DIR" to a directory containing one of the above files.  If
      "Qt6HostInfo" provides a separate development package or SDK, be sure it
      has been installed.
    Call Stack (most recent call first):
      cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:229 (include)
      cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:372 (qt_build_internals_set_up_private_api)
      CMakeLists.txt:91 (qt_build_repo_begin)
    
    
    -- Configuring incomplete, errors occurred!
    

    configure check this is directory to several files, so this is variable is a directory with early installed Qt, not path fo install host tools.



  • Look like what this is now work
    cmake/QtSetup.cmake

    .................
    ## Find host tools (if non native):
    set(QT_HOST_PATH "" CACHE PATH "Installed Qt host directory path, used for cross compiling.")
    
    if (CMAKE_CROSSCOMPILING)
        if(NOT IS_DIRECTORY "${QT_HOST_PATH}")
            message(FATAL_ERROR "You need to set QT_HOST_PATH to cross compile Qt.")
        endif()
    endif()
    
    if(NOT "${QT_HOST_PATH}" STREQUAL "")
        find_package(${INSTALL_CMAKE_NAMESPACE}HostInfo
                     CONFIG
                     REQUIRED
                     PATHS "${QT_HOST_PATH}"
                           "${QT_HOST_PATH_CMAKE_DIR}"
                     NO_CMAKE_FIND_ROOT_PATH
                     NO_DEFAULT_PATH)
    endif()
    

    So configure always check host-files, this bug or I'm incorrect understand https://www.qt.io/blog/qt-6-build-system ?

    The cross-built Qt does not build the host tools for the target platform, unless you set the CMake variable QT_BUILD_TOOLS_WHEN_CROSS_COMPILING to ON. Doing so is useful in embedded Linux environments




Log in to reply