Search code examples
windowsopenssl64-bitrestbed

Failed to locate OpenSSL dependency building restbed on windows


I'm trying to compile restbed with openssl on windows 10 using cmake 3.15.2.

I followed the instructions provided here

and thus installed openssl following these :

cd restbed\dependency\openssl
perl Configure shared VC-WIN64A
nmake
nmake test
nmake install

I then build restbed with cmake:

cmake -G "Visual Studio 15 2017 Win64" -DBUILD_EXAMPLES=YES -DBUILD_TESTS=YES ..

But I always end up with this error :

CMake Error at cmake/Findopenssl.cmake:23 (message):
  Failed to locate OpenSSL dependency.  see restbed/dependency/openssl;
  ./config shared; make all
Call Stack (most recent call first):
  CMakeLists.txt:49 (find_package)

Despite having used shared in my config command.

I looked into Findopenssl.cmake and most of the files searched are missing from my computer.

find_library( ssl_LIBRARY_STATIC libssl.a  ssleay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
find_library( crypto_LIBRARY_STATIC libcrypto.a libeay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )

find_library( ssl_LIBRARY_SHARED libssl.so libssl.dylib ssleay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
find_library( crypto_LIBRARY_SHARED libcrypto.so libcrypto.dylib libeay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )

find_path( ssl_INCLUDE openssl/ssl.h HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/inc32" "${PROJECT_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/include" "/usr/include" "/usr/local/include" "/opt/local/include" )

Besides, most of them seem to be linux paths.

I searched around and found this question that's really similar, but working on a debian and not windows. I didn't manage to find what's missing in my openssl installation.

Any idea what might be missing here ?

Thank you !


Solution

  • I found the origin of the problem and its solution.

    Here is the answer

    Since openssl changed its libraries for libcrypto.lib and libssl.lib the current Findopenssl.cmake could not find what it was looking for : libeay32.lib and `ssleay32.lib.

    I didn't manage to make it work by just changing their name in the find_library, so I just commented these and added these two lines Findopenssl.cmake :

    set(ssl_LIBRARY_SHARED "${PROJECT_SOURCE_DIR}/dependency/openssl")
    set(crypto_LIBRARY_SHARED "${PROJECT_SOURCE_DIR}/dependency/openssl")
    

    It's kind of dirty but works wonders.