我正在尝试使用 openssl 中的函数 EC_KEY_new_by_curve_name(NID_secp256k1)。但是,当我编译时,出现以下错误:
undefined symbols for architecture x86_64:
"_EC_KEY_new_by_curve_name", referenced from:
CKey::CKey() in bitcoin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我被暗示 macos openssl 不能用 ECC 扩展编译。是什么问题?如果是这样,我该如何纠正它?
最佳答案
如果您使用的是 MacOS SDK 附带的 OpenSSL 库,那么它应该会自动内置 64 位支持。
查看the first hit on Google ,我想知道您是否只是没有在您的 XCode 项目中包含正确的库。您是否将 -lcrypto
添加到项目设置中,或者忘记将 libCrypto.dylib
添加到项目的库列表中?
在我的 SnowLeopard (10.6) 机器上,我看到符号在 libCrypto
中定义:
[/usr/lib]:; nm -arch x86_64 libcrypto.0.9.8.dylib | egrep -i new_by_curve
00000000000a4ac0 T _EC_GROUP_new_by_curve_name
00000000000ab540 T _EC_KEY_new_by_curve_name
关于c - 带有macos xcode的OpenSSL ecc功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8623592/