无法在 windows 上找到 OpenSSL 依赖构建休息床

Failed to locate OpenSSL dependency building restbed on windows

我正在尝试使用 cmake 3.15.2 在 windows 10 上使用 openssl 编译 restbed。

我按照提供的说明进行操作 here

因此安装了 openssl,遵循这些:

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

然后我用 cmake 构建休息床:

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

但我总是以这个错误结束:

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)

尽管在我的配置命令中使用了 shared

我查看了 Findopenssl.cmake,我的电脑中搜索到的大部分文件都丢失了。

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" )

此外,其中大多数似乎是linux路径。

我四处搜索,发现 this question 确实很相似,但在 debian 上工作,而不是 windows。 我没能找到我的 openssl 安装中缺少的东西。

知道这里可能缺少什么吗?

谢谢!

我找到了问题的根源和解决方法。

这里是

由于 openssl 更改了 libcrypto.liblibssl.lib 的库,当前 Findopenssl.cmake 无法找到它正在寻找的内容:libeay32.lib 和 `ssleay32.lib .

我没能通过在 find_library 中更改他们的名字来让它工作,所以我只是评论了这些并添加了这两行 Findopenssl.cmake :

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

有点脏,但效果很好。

这是另一个answer

cd restbed/dependency/openssl
./config; make