Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Static build of Qt 5.15.8 with static OpenSSL
QtWS25 Last Chance

Static build of Qt 5.15.8 with static OpenSSL

Scheduled Pinned Locked Moved Unsolved General and Desktop
configurebuildsystemopensslstatic build qt
10 Posts 2 Posters 1.9k Views
  • 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.
  • Q Offline
    Q Offline
    quutee
    wrote on last edited by quutee
    #1

    I have compiled a static build of Qt 5.15.8 from the source on macOS 12 (Xcode 13) with the following option passed to the configure command to enable OpenSSL

    ../configure .... -static -release -prefix <install_dir> -openssl-linked OPENSSL_PREFIX="$OPENSSL_DIR" OPENSSL_LIBS="$OPENSSL_DIR/lib/libssl.a $OPENSSL_DIR/lib/libcrypto.a" ...
    

    The generated build (the contents of <install_dir> works fine on the machine on which it was built but gives linking errors when moved to a different machine, and setup as a kit in Qt Creator, as it still tries to find the openssl libs in OPENSSL_DIR and the expects libssl.a and libcrpyto.a to be present at $OPENSSL_DIR/lib which fails as these are build machine paths. It seems the build system hardcodes the value of these variables inside lib/pkgconfig/*.pc and lib/*.pri files.

    What is the correct way to build Qt static libs with openssl static so that it can be moved to a different machine and setup as a kit in Qt Creator?

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

      Hi and welcome to devnet,

      Out of curiosity, since Qt usually uses the cryptographic framework from Apple, why do you need OpenSSL ?

      That said, do you have both OpenSSL's static and dynamic libraires in the same folder ? If so, try to move them in a different folder.

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

      Q 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Out of curiosity, since Qt usually uses the cryptographic framework from Apple, why do you need OpenSSL ?

        That said, do you have both OpenSSL's static and dynamic libraires in the same folder ? If so, try to move them in a different folder.

        Q Offline
        Q Offline
        quutee
        wrote on last edited by quutee
        #3

        @SGaist Thanks!

        It's actually a requirement from the client to use openssl on all platforms.

        Yes, I do have both static and shared libraries in the same directory. If I remove the shared libs from the directory and keep the OPENSSL_LIBS="$OPENSSL_DIR/lib/libssl.a $OPENSSL_DIR/lib/libcrypto.a" in the configure command, I get the same issue.

        If I remove the OPENSSL_LIBS option from the configure command, then it adds -lssl and lcrypto and -L<build_machine_path> in the link command and I get a similar error.

        Ideally I think, it should not add these libraries/paths implicity with hardcoded paths and throw a missing symbols linking error.

        SGaistS 1 Reply Last reply
        0
        • Q quutee

          @SGaist Thanks!

          It's actually a requirement from the client to use openssl on all platforms.

          Yes, I do have both static and shared libraries in the same directory. If I remove the shared libs from the directory and keep the OPENSSL_LIBS="$OPENSSL_DIR/lib/libssl.a $OPENSSL_DIR/lib/libcrypto.a" in the configure command, I get the same issue.

          If I remove the OPENSSL_LIBS option from the configure command, then it adds -lssl and lcrypto and -L<build_machine_path> in the link command and I get a similar error.

          Ideally I think, it should not add these libraries/paths implicity with hardcoded paths and throw a missing symbols linking error.

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

          Strange...

          What values do you get if you use otool to check the dependencies of the network library ?

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

          Q 1 Reply Last reply
          0
          • SGaistS SGaist

            Strange...

            What values do you get if you use otool to check the dependencies of the network library ?

            Q Offline
            Q Offline
            quutee
            wrote on last edited by
            #5

            @SGaist Following is the output of the otool command.

            % otool -L libQt5Network.a
            Archive : libQt5Network.a
            libQt5Network.a(qnetworkaccessauthenticationmanager.o):
            libQt5Network.a(qnetworkaccessmanager.o):
            libQt5Network.a(qnetworkaccesscache.o):
            libQt5Network.a(qnetworkaccessbackend.o):
            libQt5Network.a(qnetworkaccessdebugpipebackend.o):
            libQt5Network.a(qnetworkaccessfilebackend.o):
            libQt5Network.a(qnetworkaccesscachebackend.o):
            libQt5Network.a(qnetworkcookie.o):
            libQt5Network.a(qnetworkcookiejar.o):
            libQt5Network.a(qnetworkrequest.o):
            libQt5Network.a(qnetworkreply.o):
            libQt5Network.a(qnetworkreplyimpl.o):
            libQt5Network.a(qnetworkreplydataimpl.o):
            libQt5Network.a(qnetworkreplyfileimpl.o):
            libQt5Network.a(qabstractnetworkcache.o):
            libQt5Network.a(qnetworkfile.o):
            libQt5Network.a(qhsts.o):
            libQt5Network.a(qhstspolicy.o):
            libQt5Network.a(qftp.o):
            libQt5Network.a(qnetworkaccessftpbackend.o):
            libQt5Network.a(qnetworkdiskcache.o):
            libQt5Network.a(qhstsstore.o):
            libQt5Network.a(bitstreams.o):
            libQt5Network.a(huffman.o):
            libQt5Network.a(hpack.o):
            libQt5Network.a(hpacktable.o):
            libQt5Network.a(http2frames.o):
            libQt5Network.a(http2streams.o):
            libQt5Network.a(http2protocol.o):
            libQt5Network.a(qabstractprotocolhandler.o):
            libQt5Network.a(qhttp2protocolhandler.o):
            libQt5Network.a(qhttpmultipart.o):
            libQt5Network.a(qhttpnetworkconnection.o):
            libQt5Network.a(qhttpnetworkconnectionchannel.o):
            libQt5Network.a(qhttpnetworkheader.o):
            libQt5Network.a(qhttpnetworkreply.o):
            libQt5Network.a(qhttpnetworkrequest.o):
            libQt5Network.a(qhttpprotocolhandler.o):
            libQt5Network.a(qhttpthreaddelegate.o):
            libQt5Network.a(qnetworkreplyhttpimpl.o):
            libQt5Network.a(qhttp2configuration.o):
            libQt5Network.a(qspdyprotocolhandler.o):
            libQt5Network.a(qnetworksession.o):
            libQt5Network.a(qnetworkconfigmanager.o):
            libQt5Network.a(qnetworkconfiguration.o):
            libQt5Network.a(qnetworkconfigmanager_p.o):
            libQt5Network.a(qbearerengine.o):
            libQt5Network.a(qbearerplugin.o):
            libQt5Network.a(qsharednetworksession.o):
            libQt5Network.a(qauthenticator.o):
            libQt5Network.a(qhostaddress.o):
            libQt5Network.a(qhostinfo.o):
            libQt5Network.a(qnetworkdatagram.o):
            libQt5Network.a(qnetworkinterface.o):
            libQt5Network.a(qnetworkproxy.o):
            libQt5Network.a(qurlinfo.o):
            libQt5Network.a(qdnslookup.o):
            libQt5Network.a(qdnslookup_unix.o):
            libQt5Network.a(qhostinfo_unix.o):
            libQt5Network.a(qnetworkinterface_unix.o):
            libQt5Network.a(qnetworkproxy_mac.o):
            libQt5Network.a(qabstractsocketengine.o):
            libQt5Network.a(qabstractsocket.o):
            libQt5Network.a(qtcpsocket.o):
            libQt5Network.a(qudpsocket.o):
            libQt5Network.a(qtcpserver.o):
            libQt5Network.a(qsocks5socketengine.o):
            libQt5Network.a(qhttpsocketengine.o):
            libQt5Network.a(qnativesocketengine.o):
            libQt5Network.a(qnativesocketengine_unix.o):
            libQt5Network.a(qlocalsocket.o):
            libQt5Network.a(qlocalserver.o):
            libQt5Network.a(qlocalsocket_unix.o):
            libQt5Network.a(qlocalserver_unix.o):
            libQt5Network.a(qasn1element.o):
            libQt5Network.a(qssl.o):
            libQt5Network.a(qsslcertificate.o):
            libQt5Network.a(qsslcertificateextension.o):
            libQt5Network.a(qsslconfiguration.o):
            libQt5Network.a(qsslcipher.o):
            libQt5Network.a(qssldiffiehellmanparameters.o):
            libQt5Network.a(qsslellipticcurve.o):
            libQt5Network.a(qsslkey_p.o):
            libQt5Network.a(qsslerror.o):
            libQt5Network.a(qsslsocket.o):
            libQt5Network.a(qsslpresharedkeyauthenticator.o):
            libQt5Network.a(qocspresponse.o):
            libQt5Network.a(qdtls.o):
            libQt5Network.a(qsslsocket_openssl_symbols.o):
            libQt5Network.a(qssldiffiehellmanparameters_openssl.o):
            libQt5Network.a(qsslcertificate_openssl.o):
            libQt5Network.a(qsslellipticcurve_openssl.o):
            libQt5Network.a(qsslkey_openssl.o):
            libQt5Network.a(qsslsocket_openssl.o):
            libQt5Network.a(qsslcontext_openssl.o):
            libQt5Network.a(qdtls_openssl.o):
            libQt5Network.a(qsslsocket_mac_shared.o):
            libQt5Network.a(qpassworddigestor.o):
            libQt5Network.a(qnetconmonitor_darwin.o):
            libQt5Network.a(moc_qnetworkaccesscache_p.o):
            libQt5Network.a(moc_qnetworkaccessbackend_p.o):
            libQt5Network.a(moc_qnetworkaccessdebugpipebackend_p.o):
            libQt5Network.a(moc_qnetworkaccessfilebackend_p.o):
            libQt5Network.a(moc_qnetworkcookiejar.o):
            libQt5Network.a(moc_qnetworkreply.o):
            libQt5Network.a(moc_qabstractnetworkcache.o):
            libQt5Network.a(moc_qnetworkfile_p.o):
            libQt5Network.a(moc_qnetworkaccessftpbackend_p.o):
            libQt5Network.a(moc_qnetworkdiskcache.o):
            libQt5Network.a(moc_qhttp2protocolhandler_p.o):
            libQt5Network.a(moc_qhttpmultipart.o):
            libQt5Network.a(moc_qhttpnetworkreply_p.o):
            libQt5Network.a(moc_qhttpthreaddelegate_p.o):
            libQt5Network.a(moc_qnetworkreplyhttpimpl_p.o):
            libQt5Network.a(moc_qspdyprotocolhandler_p.o):
            libQt5Network.a(moc_qnetworkconfigmanager_p.o):
            libQt5Network.a(moc_qnetworksession_p.o):
            libQt5Network.a(moc_qbearerplugin_p.o):
            libQt5Network.a(moc_qhostinfo_p.o):
            libQt5Network.a(moc_qnetworkproxy.o):
            libQt5Network.a(moc_qnetconmonitor_p.o):
            libQt5Network.a(moc_qdnslookup_p.o):
            libQt5Network.a(moc_qabstractsocketengine_p.o):
            libQt5Network.a(moc_qtcpsocket.o):
            libQt5Network.a(moc_qudpsocket.o):
            libQt5Network.a(moc_qsocks5socketengine_p.o):
            libQt5Network.a(moc_qhttpsocketengine_p.o):
            libQt5Network.a(moc_qnativesocketengine_p.o):
            libQt5Network.a(moc_qsslerror.o):
            libQt5Network.a(moc_qdtls.o):
            
            SGaistS 1 Reply Last reply
            0
            • Q quutee

              @SGaist Following is the output of the otool command.

              % otool -L libQt5Network.a
              Archive : libQt5Network.a
              libQt5Network.a(qnetworkaccessauthenticationmanager.o):
              libQt5Network.a(qnetworkaccessmanager.o):
              libQt5Network.a(qnetworkaccesscache.o):
              libQt5Network.a(qnetworkaccessbackend.o):
              libQt5Network.a(qnetworkaccessdebugpipebackend.o):
              libQt5Network.a(qnetworkaccessfilebackend.o):
              libQt5Network.a(qnetworkaccesscachebackend.o):
              libQt5Network.a(qnetworkcookie.o):
              libQt5Network.a(qnetworkcookiejar.o):
              libQt5Network.a(qnetworkrequest.o):
              libQt5Network.a(qnetworkreply.o):
              libQt5Network.a(qnetworkreplyimpl.o):
              libQt5Network.a(qnetworkreplydataimpl.o):
              libQt5Network.a(qnetworkreplyfileimpl.o):
              libQt5Network.a(qabstractnetworkcache.o):
              libQt5Network.a(qnetworkfile.o):
              libQt5Network.a(qhsts.o):
              libQt5Network.a(qhstspolicy.o):
              libQt5Network.a(qftp.o):
              libQt5Network.a(qnetworkaccessftpbackend.o):
              libQt5Network.a(qnetworkdiskcache.o):
              libQt5Network.a(qhstsstore.o):
              libQt5Network.a(bitstreams.o):
              libQt5Network.a(huffman.o):
              libQt5Network.a(hpack.o):
              libQt5Network.a(hpacktable.o):
              libQt5Network.a(http2frames.o):
              libQt5Network.a(http2streams.o):
              libQt5Network.a(http2protocol.o):
              libQt5Network.a(qabstractprotocolhandler.o):
              libQt5Network.a(qhttp2protocolhandler.o):
              libQt5Network.a(qhttpmultipart.o):
              libQt5Network.a(qhttpnetworkconnection.o):
              libQt5Network.a(qhttpnetworkconnectionchannel.o):
              libQt5Network.a(qhttpnetworkheader.o):
              libQt5Network.a(qhttpnetworkreply.o):
              libQt5Network.a(qhttpnetworkrequest.o):
              libQt5Network.a(qhttpprotocolhandler.o):
              libQt5Network.a(qhttpthreaddelegate.o):
              libQt5Network.a(qnetworkreplyhttpimpl.o):
              libQt5Network.a(qhttp2configuration.o):
              libQt5Network.a(qspdyprotocolhandler.o):
              libQt5Network.a(qnetworksession.o):
              libQt5Network.a(qnetworkconfigmanager.o):
              libQt5Network.a(qnetworkconfiguration.o):
              libQt5Network.a(qnetworkconfigmanager_p.o):
              libQt5Network.a(qbearerengine.o):
              libQt5Network.a(qbearerplugin.o):
              libQt5Network.a(qsharednetworksession.o):
              libQt5Network.a(qauthenticator.o):
              libQt5Network.a(qhostaddress.o):
              libQt5Network.a(qhostinfo.o):
              libQt5Network.a(qnetworkdatagram.o):
              libQt5Network.a(qnetworkinterface.o):
              libQt5Network.a(qnetworkproxy.o):
              libQt5Network.a(qurlinfo.o):
              libQt5Network.a(qdnslookup.o):
              libQt5Network.a(qdnslookup_unix.o):
              libQt5Network.a(qhostinfo_unix.o):
              libQt5Network.a(qnetworkinterface_unix.o):
              libQt5Network.a(qnetworkproxy_mac.o):
              libQt5Network.a(qabstractsocketengine.o):
              libQt5Network.a(qabstractsocket.o):
              libQt5Network.a(qtcpsocket.o):
              libQt5Network.a(qudpsocket.o):
              libQt5Network.a(qtcpserver.o):
              libQt5Network.a(qsocks5socketengine.o):
              libQt5Network.a(qhttpsocketengine.o):
              libQt5Network.a(qnativesocketengine.o):
              libQt5Network.a(qnativesocketengine_unix.o):
              libQt5Network.a(qlocalsocket.o):
              libQt5Network.a(qlocalserver.o):
              libQt5Network.a(qlocalsocket_unix.o):
              libQt5Network.a(qlocalserver_unix.o):
              libQt5Network.a(qasn1element.o):
              libQt5Network.a(qssl.o):
              libQt5Network.a(qsslcertificate.o):
              libQt5Network.a(qsslcertificateextension.o):
              libQt5Network.a(qsslconfiguration.o):
              libQt5Network.a(qsslcipher.o):
              libQt5Network.a(qssldiffiehellmanparameters.o):
              libQt5Network.a(qsslellipticcurve.o):
              libQt5Network.a(qsslkey_p.o):
              libQt5Network.a(qsslerror.o):
              libQt5Network.a(qsslsocket.o):
              libQt5Network.a(qsslpresharedkeyauthenticator.o):
              libQt5Network.a(qocspresponse.o):
              libQt5Network.a(qdtls.o):
              libQt5Network.a(qsslsocket_openssl_symbols.o):
              libQt5Network.a(qssldiffiehellmanparameters_openssl.o):
              libQt5Network.a(qsslcertificate_openssl.o):
              libQt5Network.a(qsslellipticcurve_openssl.o):
              libQt5Network.a(qsslkey_openssl.o):
              libQt5Network.a(qsslsocket_openssl.o):
              libQt5Network.a(qsslcontext_openssl.o):
              libQt5Network.a(qdtls_openssl.o):
              libQt5Network.a(qsslsocket_mac_shared.o):
              libQt5Network.a(qpassworddigestor.o):
              libQt5Network.a(qnetconmonitor_darwin.o):
              libQt5Network.a(moc_qnetworkaccesscache_p.o):
              libQt5Network.a(moc_qnetworkaccessbackend_p.o):
              libQt5Network.a(moc_qnetworkaccessdebugpipebackend_p.o):
              libQt5Network.a(moc_qnetworkaccessfilebackend_p.o):
              libQt5Network.a(moc_qnetworkcookiejar.o):
              libQt5Network.a(moc_qnetworkreply.o):
              libQt5Network.a(moc_qabstractnetworkcache.o):
              libQt5Network.a(moc_qnetworkfile_p.o):
              libQt5Network.a(moc_qnetworkaccessftpbackend_p.o):
              libQt5Network.a(moc_qnetworkdiskcache.o):
              libQt5Network.a(moc_qhttp2protocolhandler_p.o):
              libQt5Network.a(moc_qhttpmultipart.o):
              libQt5Network.a(moc_qhttpnetworkreply_p.o):
              libQt5Network.a(moc_qhttpthreaddelegate_p.o):
              libQt5Network.a(moc_qnetworkreplyhttpimpl_p.o):
              libQt5Network.a(moc_qspdyprotocolhandler_p.o):
              libQt5Network.a(moc_qnetworkconfigmanager_p.o):
              libQt5Network.a(moc_qnetworksession_p.o):
              libQt5Network.a(moc_qbearerplugin_p.o):
              libQt5Network.a(moc_qhostinfo_p.o):
              libQt5Network.a(moc_qnetworkproxy.o):
              libQt5Network.a(moc_qnetconmonitor_p.o):
              libQt5Network.a(moc_qdnslookup_p.o):
              libQt5Network.a(moc_qabstractsocketengine_p.o):
              libQt5Network.a(moc_qtcpsocket.o):
              libQt5Network.a(moc_qudpsocket.o):
              libQt5Network.a(moc_qsocks5socketengine_p.o):
              libQt5Network.a(moc_qhttpsocketengine_p.o):
              libQt5Network.a(moc_qnativesocketengine_p.o):
              libQt5Network.a(moc_qsslerror.o):
              libQt5Network.a(moc_qdtls.o):
              
              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Wait, which linking errors are you getting exactly ?

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

              Q 1 Reply Last reply
              0
              • SGaistS SGaist

                Wait, which linking errors are you getting exactly ?

                Q Offline
                Q Offline
                quutee
                wrote on last edited by
                #7

                @SGaist I am getting the following errors

                clang: error: no such file or directory: '/Users/qtbuilder/Downloads/openssl-1.1.1t/install_dir/lib/libssl.a'
                clang: error: no such file or directory: '/Users/qtbuilder/Downloads/openssl-1.1.1t/install_dir/lib/libcrypto.a'
                

                Note that this path is present only on the machine where qt was built from source (static with static openssl). If I copy the install directory (generated by make install) to another machine, then I get these errors on building samples that require openssl (eg securesocketclient). Somehow the paths passed in OPENSSL_LIBS configure variable get hardcoded.

                SGaistS 1 Reply Last reply
                0
                • Q quutee

                  @SGaist I am getting the following errors

                  clang: error: no such file or directory: '/Users/qtbuilder/Downloads/openssl-1.1.1t/install_dir/lib/libssl.a'
                  clang: error: no such file or directory: '/Users/qtbuilder/Downloads/openssl-1.1.1t/install_dir/lib/libcrypto.a'
                  

                  Note that this path is present only on the machine where qt was built from source (static with static openssl). If I copy the install directory (generated by make install) to another machine, then I get these errors on building samples that require openssl (eg securesocketclient). Somehow the paths passed in OPENSSL_LIBS configure variable get hardcoded.

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

                  I would check the content of the .prf files in your Qt installation folder.

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

                  Q 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    I would check the content of the .prf files in your Qt installation folder.

                    Q Offline
                    Q Offline
                    quutee
                    wrote on last edited by
                    #9

                    @SGaist There are .prl and .pc files in <install_dir>/lib that contain these hardcoded paths.

                    SGaistS 1 Reply Last reply
                    0
                    • Q quutee

                      @SGaist There are .prl and .pc files in <install_dir>/lib that contain these hardcoded paths.

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

                      @quutee sounds like it's a bug. You should check the bug report system to see if there's something related.

                      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

                      • Login

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