Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Qt6 Static Cross Compile with OpenSSL
Forum Updated to NodeBB v4.3 + New Features

Qt6 Static Cross Compile with OpenSSL

Scheduled Pinned Locked Moved Solved Qt 6
18 Posts 3 Posters 4.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    squinky86
    wrote on last edited by squinky86
    #9

    I filed a QTBUG and @Croitor-Alexandru patiently pointed me towards needing to specify the cmake profile as well when configuring a cross compile. Qt6 configured correctly (though it's still not building) with his input.

    Missing option: "-DCMAKE_TOOLCHAIN_FILE=/home/jon/w64/profile.cmake" where profile.cmake is the same one I use for everything. Just in case anyone comes here from google, here's the profile that mostly worked (you can probably drop the Fortran compiler, but I at least know this works and don't feel like testing without it).

    set(CMAKE_SYSTEM_NAME Windows)
    set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
    set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
    set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
    set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
    set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
    set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
    

    That gets through the configure, but the build fails pretty hard in the Gui target. I'm going to try some things (update cmake, switch to ninja, etc.) and create another thread in these forums if I can't figure it out on my end.

    EDIT: Got it working with no additional modifications using cmake 3.18 and regular Makefiles.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #10

      Thanks for the detailed feedback !

      Can you share the bug url ? That may be useful for other people.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      0
      • SGaistS SGaist

        Thanks for the detailed feedback !

        Can you share the bug url ? That may be useful for other people.

        S Offline
        S Offline
        squinky86
        wrote on last edited by squinky86
        #11

        @SGaist said in Qt6 Static Cross Compile with OpenSSL:

        Thanks for the detailed feedback !

        Can you share the bug url ? That may be useful for other people.

        QTBUG-102250

        I now have Qt6 cross compiled and working. Some of my slots and signals are not working, but I'm slowly figuring it out.

        EDIT: Slots and signals are now fixed. Qt5 gave me some overloaded interfaces that I wasn't supposed to be using. Switching those over resulted in successful unit tests! Once I get appveyor set up for my nightly builds, I'll be 100% ported over to Qt6 thanks to everyone's help here.

        1 Reply Last reply
        1
        • SGaistS SGaist

          Nothing stands out as wrong with the options you use.

          You may have found an issue with the win32 cross-compilation.

          rightecR Offline
          rightecR Offline
          rightec
          wrote on last edited by
          #12

          @SGaist Hello
          if it possible i would like some more explanation about the config command.
          If i read " -openssl-linked --" I imagine that openSSL support is already been built against the cross compiler and
          the result of building lays on the folder indicated by -DOPENSSL_ROOT_DIR=/home/jon/w64/openssl-3.0.2. (in this example)
          But what about the native QT openSsl support that we have in "qtbase/src/plugins/tls/openssl" ?
          How can we include it in the cross compilation?

          My question rises from an error that i got compilig a websocket QT project against arm32:
          error: ‘class QWebSocket’ has no member named ‘ignoreSslErrors’
          96 | m_webSocket.ignoreSslErrors();

          Thanks for answering
          Regards
          FM

          SGaistS 1 Reply Last reply
          0
          • rightecR rightec

            @SGaist Hello
            if it possible i would like some more explanation about the config command.
            If i read " -openssl-linked --" I imagine that openSSL support is already been built against the cross compiler and
            the result of building lays on the folder indicated by -DOPENSSL_ROOT_DIR=/home/jon/w64/openssl-3.0.2. (in this example)
            But what about the native QT openSsl support that we have in "qtbase/src/plugins/tls/openssl" ?
            How can we include it in the cross compilation?

            My question rises from an error that i got compilig a websocket QT project against arm32:
            error: ‘class QWebSocket’ has no member named ‘ignoreSslErrors’
            96 | m_webSocket.ignoreSslErrors();

            Thanks for answering
            Regards
            FM

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #13

            @rightec hi,

            OpenSSL linked means that the backend is directly linked against OpenSSL. The plugins/tls/openssl folder is that backend.

            If you have the support missing, then it means that the detection somehow failed. Check the cmake logs to see what exactly failed.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            rightecR 1 Reply Last reply
            0
            • SGaistS SGaist

              @rightec hi,

              OpenSSL linked means that the backend is directly linked against OpenSSL. The plugins/tls/openssl folder is that backend.

              If you have the support missing, then it means that the detection somehow failed. Check the cmake logs to see what exactly failed.

              rightecR Offline
              rightecR Offline
              rightec
              wrote on last edited by
              #14

              @SGaist Hello
              First of all, thank you for your clarification
              I was able to compile correctly after downloading the openSSL source code from git (OpenSSL_1_1_1-stable branch) and building it against the cross compiler.
              Building process seems ok now, but at run time the qt sample sslechoclient returns me the following:

              ./sslechoclient.sh
              qt.network.ssl: The backend "cert-only" does not support QSslKey
              qt.network.ssl: Active TLS backend does not support key creation
              qt.network.ssl: The backend "cert-only" does not support QSslKey
              qt.network.ssl: Active TLS backend does not support key creation
              qt.network.ssl: The backend "cert-only" does not support QSslKey
              qt.network.ssl: Active TLS backend does not support key creation
              qt.network.ssl: The backend "cert-only" does not support QSslKey
              qt.network.ssl: Active TLS backend does not support key creation

              That sounds me strange. The OpenSSL version i've cross-compiled is 1.1.1t, the version i got on my Ubuntu host system is 1.1.1f. That is the only difference.
              Do you have any idea?

              QT is 6.2.4 on both target and host
              Thanks
              Regards
              FM

              rightecR 1 Reply Last reply
              0
              • rightecR rightec

                @SGaist Hello
                First of all, thank you for your clarification
                I was able to compile correctly after downloading the openSSL source code from git (OpenSSL_1_1_1-stable branch) and building it against the cross compiler.
                Building process seems ok now, but at run time the qt sample sslechoclient returns me the following:

                ./sslechoclient.sh
                qt.network.ssl: The backend "cert-only" does not support QSslKey
                qt.network.ssl: Active TLS backend does not support key creation
                qt.network.ssl: The backend "cert-only" does not support QSslKey
                qt.network.ssl: Active TLS backend does not support key creation
                qt.network.ssl: The backend "cert-only" does not support QSslKey
                qt.network.ssl: Active TLS backend does not support key creation
                qt.network.ssl: The backend "cert-only" does not support QSslKey
                qt.network.ssl: Active TLS backend does not support key creation

                That sounds me strange. The OpenSSL version i've cross-compiled is 1.1.1t, the version i got on my Ubuntu host system is 1.1.1f. That is the only difference.
                Do you have any idea?

                QT is 6.2.4 on both target and host
                Thanks
                Regards
                FM

                rightecR Offline
                rightecR Offline
                rightec
                wrote on last edited by
                #15

                @rightec said in Qt6 Static Cross Compile with OpenSSL:

                Active TLS backend does not support key creation

                I solved compiling openSSL 111f on the target

                SGaistS 1 Reply Last reply
                0
                • rightecR rightec

                  @rightec said in Qt6 Static Cross Compile with OpenSSL:

                  Active TLS backend does not support key creation

                  I solved compiling openSSL 111f on the target

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #16

                  @rightec any chances you built OpenSSL for your host rather than your target ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  rightecR 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    @rightec any chances you built OpenSSL for your host rather than your target ?

                    rightecR Offline
                    rightecR Offline
                    rightec
                    wrote on last edited by
                    #17

                    @SGaist I did not try. BTW host is 64 bit and target 32.

                    SGaistS 1 Reply Last reply
                    0
                    • rightecR rightec

                      @SGaist I did not try. BTW host is 64 bit and target 32.

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #18

                      The fact that it's a 32 bit target is not an issue. Depending on the library, the harder is often to make its build system use the cross-compiler on the host (things have vastly improved on that side since I was doing embedded work).

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • F FrogCruiser referenced this topic on

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved