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. can't link correctly static openssl libraries
Forum Updated to NodeBB v4.3 + New Features

can't link correctly static openssl libraries

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 388 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.
  • V Offline
    V Offline
    vofr
    wrote on 8 Feb 2024, 12:26 last edited by
    #1

    Hello!
    I have a cross-platform application which uses openssl for encryption, i used static libraries(crypto and ssl) which i added in CMake based on running os, it works on macos, ios, android but on windows not. the library works because i used g++ to compile a simple .cpp without errors.

    here i include libs

    if(WIN32)
        target_link_libraries(appmy_qt
            PUBLIC
            ${A_DIR_MODULE_ROOT}/platform/windows/lib/libcrypto.lib
            ${A_DIR_MODULE_ROOT}/platform/windows/lib/libssl.lib
        )
    endif()
    

    C:/Internship2023/qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/appmy_qt.dir/security/cryptography.cpp.obj: in function Cryptography::createPrivateRSA(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': C:/Internship2023/my_qt/security/cryptography.cpp:35: undefined reference to BIO_new_mem_buf'
    C:/Internship2023/qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Internship2023/my_qt/security/cryptography.cpp:40: undefined reference to `PEM_read_bio_RSAPrivateKey'

    Did anyone encounter this problem before?

    C 1 Reply Last reply 8 Feb 2024, 12:32
    0
    • V vofr
      8 Feb 2024, 12:26

      Hello!
      I have a cross-platform application which uses openssl for encryption, i used static libraries(crypto and ssl) which i added in CMake based on running os, it works on macos, ios, android but on windows not. the library works because i used g++ to compile a simple .cpp without errors.

      here i include libs

      if(WIN32)
          target_link_libraries(appmy_qt
              PUBLIC
              ${A_DIR_MODULE_ROOT}/platform/windows/lib/libcrypto.lib
              ${A_DIR_MODULE_ROOT}/platform/windows/lib/libssl.lib
          )
      endif()
      

      C:/Internship2023/qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/appmy_qt.dir/security/cryptography.cpp.obj: in function Cryptography::createPrivateRSA(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': C:/Internship2023/my_qt/security/cryptography.cpp:35: undefined reference to BIO_new_mem_buf'
      C:/Internship2023/qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Internship2023/my_qt/security/cryptography.cpp:40: undefined reference to `PEM_read_bio_RSAPrivateKey'

      Did anyone encounter this problem before?

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 8 Feb 2024, 12:32 last edited by
      #2

      @vofr said in can't link correctly static openssl libraries:

      ${A_DIR_MODULE_ROOT}/platform/windows/lib/libcrypto.lib

      These are MSVC import libs.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1

      1/2

      8 Feb 2024, 12:26

      • Login

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