Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Solved Building and linking Qt5.6.2 static windows with openssl and mingw4.9.2 ?

    Installation and Deployment
    2
    7
    3017
    Loading More Posts
    • 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
      stephane78 last edited by stephane78

      Hi,
      for internals purposes we need to build Qt static with mingw.before we used 5.3.2 but now we use 5.6.2 and we have problems with openssl and QtNetwork with 5.6.2 static.
      the tools xmlpatterns doesn't build and if I use the libs of qtbase to build our project we have undefined reference with libQt5Network and openssl (we build Qt with openssl_linked and with the right "OPENSSL_LIBS=...") :

      g++ -Wl,--gc-sections -Wl,-s -Wl,-subsystem,console -o ....\bin\xmlpatterns.exe .obj/release/main.o .obj/release/qapplicationargument.o .obj/release/qapplicationargum
      entparser.o .obj/release/xmlpatterns_plugin_import.o -LC:\Qt\Qt5.6.2\5.6\Src\qtxmlpatterns\lib C:\Qt\Qt5.6.2\5.6\Src\qtxmlpatterns\lib\libQt5XmlPatterns.a -LC:\Qt\Qt5
      .6.2\5.6\Src\qtbase\lib -Lc:\openssl\lib -LC:\Qt\Qt5.6.2\5.6\Src\qtbase\plugins\bearer C:\Qt\Qt5.6.2\5.6\Src\qtbase\plugins\bearer\libqgenericbearer.a C:\Qt\Qt5.6.2\5.
      6\Src\qtbase\plugins\bearer\libqnativewifibearer.a C:\Qt\Qt5.6.2\5.6\Src\qtbase\lib\libQt5Network.a -ldnsapi -liphlpapi -lcrypto -lssl -lgdi32 -lUser32 -lcrypt32 C:\Qt
      \Qt5.6.2\5.6\Src\qtbase\lib\libQt5Core.a -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr C:\Qt\Qt5.6.2\5.6\Src\qtbase\lib\libqtpcre.a
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x1e6): undefined reference to COMP_CTX_free' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x202): undefined reference to COMP_CTX_free'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xaba): undefined reference to BIO_s_socket' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xbb5): undefined reference to BIO_s_socket'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xd25): undefined reference to BIO_s_socket' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x14f0): undefined reference to COMP_CTX_free'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x150c): undefined reference to COMP_CTX_free' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x1610): undefined reference to COMP_CTX_free'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x162c): undefined reference to COMP_CTX_free' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x357a): undefined reference to COMP_CTX_free'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x3596): more undefined references to COMP_CTX_free' follow c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x5e6c): undefined reference to X509_STORE_set_default_paths'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x5e7c): undefined reference to X509_STORE_load_locations' C:/Qt/Qt5.6.2/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: c:\openssl\lib/libssl.a(ssl_lib.o): bad reloc address 0x 80 in section .data'
      collect2.exe: error: ld returned 1 exit status
      Makefile.Release:64: recipe for target '....\bin\xmlpatternsvalidator.exe' failed
      mingw32-make[4]: *** [....\bin\xmlpatternsvalidator.exe] Error 1
      mingw32-make[4]: Leaving directory 'c:/Qt/Qt5.6.2/5.6/Src/qtxmlpatterns/tools/xmlpatternsvalidator'
      Makefile:34: recipe for target 'release' failed
      mingw32-make[3]: *** [release] Error 2
      mingw32-make[3]: Leaving directory 'c:/Qt/Qt5.6.2/5.6/Src/qtxmlpatterns/tools/xmlpatternsvalidator'
      Makefile:64: recipe for target 'sub-xmlpatternsvalidator-make_first' failed
      mingw32-make[2]: *** [sub-xmlpatternsvalidator-make_first] Error 2
      mingw32-make[2]: *** Waiting for unfinished jobs....
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x1e6): undefined reference to COMP_CTX_free' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x202): undefined reference to COMP_CTX_free'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xaba): undefined reference to BIO_s_socket' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xbb5): undefined reference to BIO_s_socket'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0xd25): undefined reference to BIO_s_socket' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x14f0): undefined reference to COMP_CTX_free'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x150c): undefined reference to COMP_CTX_free' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x1610): undefined reference to COMP_CTX_free'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x162c): undefined reference to COMP_CTX_free' c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x357a): undefined reference to COMP_CTX_free'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x3596): more undefined references to COMP_CTX_free' follow c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x5e6c): undefined reference to X509_STORE_set_default_paths'
      c:\openssl\lib/libssl.a(ssl_lib.o):ssl_lib.c:(.text+0x5e7c): undefined reference to X509_STORE_load_locations' C:/Qt/Qt5.6.2/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: c:\openssl\lib/libssl.a(ssl_lib.o): bad reloc address 0x 80 in section .data'
      collect2.exe: error: ld returned 1 exit status
      Makefile.Release:72: recipe for target '....\bin\xmlpatterns.exe' failed
      mingw32-make[4]: *** [....\bin\xmlpatterns.exe] Error 1
      mingw32-make[4]: Leaving directory 'c:/Qt/Qt5.6.2/5.6/Src/qtxmlpatterns/tools/xmlpatterns'
      Makefile:34: recipe for target 'release' failed
      mingw32-make[3]: *** [release] Error 2
      mingw32-make[3]: Leaving directory 'c:/Qt/Qt5.6.2/5.6/Src/qtxmlpatterns/tools/xmlpatterns'
      Makefile:39: recipe for target 'sub-xmlpatterns-make_first' failed
      mingw32-make[2]: *** [sub-xmlpatterns-make_first] Error 2
      mingw32-make[2]: Leaving directory 'c:/Qt/Qt5.6.2/5.6/Src/qtxmlpatterns/tools'
      Makefile:66: recipe for target 'sub-tools-make_first' failed
      mingw32-make[1]: *** [sub-tools-make_first] Error 2
      mingw32-make[1]: Leaving directory 'c:/Qt/Qt5.6.2/5.6/Src/qtxmlpatterns'
      makefile:264: recipe for target 'module-qtxmlpatterns-make_first' failed
      mingw32-make: *** [module-qtxmlpatterns-make_first] Error 2

      c:\Qt\Qt5.6.2\5.6\Src>configure.bat -static -release -platform win32-g++ -prefix "C:\Qt\Qt5.6.2_static_kk" -qt-sql-sqlite -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -openssl-linked -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests OPENSSL_LIBS="-lcrypto -lssl -lgdi32 -lUser32" -L c:\openssl\lib -I c:\openssl\include -skip qtwebengine -skip qtwebview -skip qt3d

      S 1 Reply Last reply Reply Quote 0
      • S
        stephane78 @stephane78 last edited by

        And I want to say that we haven't any problems with the dynamic version (because we distribute with Qt dynamic) but the static version of Qt5.6.2 with openssl has this problem

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          Are your OpenSSL libraries also built with the same compiler you are using to build Qt ?

          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 Reply Quote 0
          • S
            stephane78 @SGaist last edited by

            @SGaist Yes with the mingw4.9.2 (32 bits) of Qt5.6.2.
            But the path of perl was not available during the build. is it the reason why it failed ?
            I will try again with the path of perl in the environment variable path....

            S 1 Reply Last reply Reply Quote 0
            • S
              stephane78 @stephane78 last edited by

              @SGaist,ok it is stupid I have inverted the order : I have putted -lcrypto -lssl instead of -lssl -lcrypto.I should have put -lssl -lcrypto....the problem the compilation of Qt is already fast finished.I Hope I could invert in the makefile of my project......

              1 Reply Last reply Reply Quote 1
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                Right, the order is important when building something with static libs.

                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 Reply Quote 0
                • S
                  stephane78 @SGaist last edited by

                  @SGaist I could build a version (with -lssl -lcrypto) so my problem is solved.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post