gpt4 book ai didi

c++ - cmake在Mac OS X上找不到openssl库(尽管手动添加)

转载 作者:行者123 更新时间:2023-12-02 10:35:56 31 4
gpt4 key购买 nike

我正在尝试在OSX 10.13.6上编译https://github.com/dmikushin/binance-cxx-api
(由于代码是为Linux编写的,因此我不得不稍作调整)

我收到以下错误(据我所知与openssl相关):

Undefined symbols for architecture x86_64:
"_EVP_sha256", referenced from:
binance::hmac_sha256(char const*, char const*) in binance_utils.cpp.o
"_HMAC", referenced from:
binance::hmac_sha256(char const*, char const*) in binance_utils.cpp.o
"_SHA256_Final", referenced from:
binance::sha256(char const*) in binance_utils.cpp.o
"_SHA256_Init", referenced from:
binance::sha256(char const*) in binance_utils.cpp.o
"_SHA256_Update", referenced from:
binance::sha256(char const*) in binance_utils.cpp.o
ld: symbol(s) not found for architecture x86_64

该项目基于cmake,未找到或链接到openssl(随自制软件一起安装)

我直接在cmake GUI中添加了include和lib dirs->编译器,链接器标志
(取了include目录,仍然给了我错误)

还应用了以下类似的几种组合=>并没有使错误消失
cmake -DOPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl/1.0.2d_1/include  -DOPENSSL_CRYPTO_LIBRARY=/usr/local/Cellar/openssl/1.0.2d_1/lib/libcrypto.dylib -DOPENSSL_SSL_LIBRARY=/usr/local/Cellar/openssl/1.0.2d_1/lib/libssl.dylib

谷歌搜索没有提出新的想法(大多数错误似乎由cmake -DOPENSSL ..选项修复。)

有人有主意吗?

最佳答案

您是否考虑过编辑cmake项目?

CMakeLists.txt中添加以下行:

FIND_PACKAGE(OpenSSL)
if(${OpenSSL_FOUND})
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
endif()

并编辑以下行以链接到OpenSSL
target_link_libraries(${PROJECT_NAME} jsoncpp curl websockets ssl crypto)

关于c++ - cmake在Mac OS X上找不到openssl库(尽管手动添加),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60285971/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com