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. Trying to link with OpenSSL libraries in Windows
Forum Updated to NodeBB v4.3 + New Features

Trying to link with OpenSSL libraries in Windows

Scheduled Pinned Locked Moved Solved General and Desktop
opensslmingw32
6 Posts 4 Posters 10.6k Views 4 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.
  • A Offline
    A Offline
    azarubkin
    wrote on last edited by
    #1

    Hello!

    I'm making a project which includes a statically linked library which in turn uses OpenSSL.
    I have installed 32-bit OpenSSL from https://slproweb.com/products/Win32OpenSSL.html in default folder.
    I have added to my static library pro file:

    INCLUDEPATH += C:/OpenSSL-Win32/include
    DEPENDPATH += C:/OpenSSL-Win32/include
    

    I have added to my application pro file:

    win32: LIBS += -L"C:/OpenSSL-Win32/lib/MinGW/" -leay32
    

    I get:

    C:\Qt\projects\build-config-Desktop_Qt_5_4_2_MinGW_32bit-Debug\common/../../config/common/QueryLogic.cpp:650: undefined reference to `AES_set_encrypt_key'
    C:\Qt\projects\build-config-Desktop_Qt_5_4_2_MinGW_32bit-Debug\common/../../config/common/QueryLogic.cpp:651: undefined reference to `AES_encrypt'
    

    If I change my application pro file to:

    win32: LIBS += -L"C:/OpenSSL-Win32/lib/MinGW/" -llibeay32
    

    I get:

    C:/Qt/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibeay32
    

    But libeay32.a is there, in C:/OpenSSL-Win32/lib/MinGW/ folder. How do I link with OpenSSL in Windows?

    Thanks!

    JKSHJ 1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

      Linkage is done from right to left. Maybe you're adding your static library after openssl. Put it before.

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

        Hi,

        Do you also have libcrypto in your OpenSSL install ?

        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
        • L Offline
          L Offline
          Leonardo
          wrote on last edited by
          #4

          libcrypto is how it's called on unix systems. On Windows it's libeay32.

          1 Reply Last reply
          1
          • A azarubkin

            Hello!

            I'm making a project which includes a statically linked library which in turn uses OpenSSL.
            I have installed 32-bit OpenSSL from https://slproweb.com/products/Win32OpenSSL.html in default folder.
            I have added to my static library pro file:

            INCLUDEPATH += C:/OpenSSL-Win32/include
            DEPENDPATH += C:/OpenSSL-Win32/include
            

            I have added to my application pro file:

            win32: LIBS += -L"C:/OpenSSL-Win32/lib/MinGW/" -leay32
            

            I get:

            C:\Qt\projects\build-config-Desktop_Qt_5_4_2_MinGW_32bit-Debug\common/../../config/common/QueryLogic.cpp:650: undefined reference to `AES_set_encrypt_key'
            C:\Qt\projects\build-config-Desktop_Qt_5_4_2_MinGW_32bit-Debug\common/../../config/common/QueryLogic.cpp:651: undefined reference to `AES_encrypt'
            

            If I change my application pro file to:

            win32: LIBS += -L"C:/OpenSSL-Win32/lib/MinGW/" -llibeay32
            

            I get:

            C:/Qt/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibeay32
            

            But libeay32.a is there, in C:/OpenSSL-Win32/lib/MinGW/ folder. How do I link with OpenSSL in Windows?

            Thanks!

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            @azarubkin said:

            I have added to my application pro file:

            win32: LIBS += -L"C:/OpenSSL-Win32/lib/MinGW/" -leay32
            

            This works for me: LIBS += C:/OpenSSL-Win32/lib/libeay32.lib

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • L Leonardo

              Linkage is done from right to left. Maybe you're adding your static library after openssl. Put it before.

              A Offline
              A Offline
              azarubkin
              wrote on last edited by
              #6

              @Leonardo said:

              Linkage is done from right to left. Maybe you're adding your static library after openssl. Put it before.
              Yes, you're right. Moving static library after openssl solved my issue.

              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