Search code examples
amazon-s3cmakeopensslembedded-linuxcross-compiling

Could not find OpenSSL ... missing: OPENSSL_CRYPTO_LIBRARY


I am trying to cross-compile the aws-sdk-cpp and I am getting the following error just the very first time I run CMAKE. If I run it a second time it compiles and links and I have tested the application and I can indeed use the aws-sdk-cpp functionality. I have searched and searched for days and tried all kinds of things:

  • Setting environment variable for OPENSSL_ROOT_DIR
  • Setting it in a cmake variable, etc.

I print the OPENSSL_ROOT_DIR variable right before the call to

find_package(OpenSSL REQUIRED) 

and it prints the right PATH.

I have also set the variable OPENSSL_USE_STATIC_LIBS to TRUE without any difference. I honestly don't understand what is going on since if I run it a second time it builds and links just fine.

CMake Error at /snap/cmake/1035/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
  OPENSSL_INCLUDE_DIR) (found version "1.1.1n")
Call Stack (most recent call first):
  /snap/cmake/1035/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /snap/cmake/1035/share/cmake-3.22/Modules/FindOpenSSL.cmake:574 (find_package_handle_standard_args)
  Projects/libraries/aws/s3/crt/aws-crt-cpp/crt/aws-c-cal/CMakeLists.txt:89 (find_package)

Solution

  • Ok so I have figured what was going on.

    the issue was that I was setting the values for

    OPENSSL_INCLUDE_DIR
    OPENSSL_CRYPTO_LIBRARY
    OPENSSL_SSL_LIBRARY
    

    Once I deleted them it worked.