Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-112951

configure -sysroot is not enough for cross compilation, one must also define CMAKE_SYSROOT

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P4: Low
    • None
    • 6.6
    • Build System: CMake
    • None
    • 305f61a80 (dev)

    Description

      I configure like this:

          PKG_CONFIG_PATH=  \
          PKG_CONFIG_SYSROOT_DIR="$SYSROOT" \
          PKG_CONFIG_LIBDIR="$SYSROOT/usr/lib/$TRIPLET/pkgconfig:$SYSROOT/usr/share/pkgconfig" \
              $SRC_DIR/configure \
              -make examples -xcb -opengl es2 -debug -linker lld \
              -sysroot "$SYSROOT" -prefix "$PREFIX" \
              -qt-host-path "$QT_HOST_PATH" \
              --  -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \
                  -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" -DCMAKE_ASM_FLAGS="$ASMFLAGS" \
                  -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS" -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" -DCMAKE_MODULE_LINKER_FLAGS="$LDFLAGS" \
                  -DCMAKE_SYSROOT="$SYSROOT" -DCMAKE_SYSTEM_NAME=Linux \
                  -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
                  -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY
      

      Notice that I have both -sysroot and -D CMAKE_SYSROOT. The result is success. I also get the following warning:

      CMake Warning:
        Manually-specified variables were not used by the project:
      
          INPUT_sysroot
      

      If I omit -D CMAKE_SYSROOT, then the configuration fails (because of failing to find some libraries). Shouldn't configure -sysroot set the CMAKE variable automatically?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mrmsdbdl Amir Masoud Abdol
            jimis Dimitrios Apostolou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes