android - libssl 和 libcrypto 的 undefined reference 错误

标签 android openssl libssl libcrypto fortify-source

我正在使用 android-4.4_r1 (KRT16S) 构建 Android 平台。我可以毫不费力地将源代码(这是一个大项目)编译成 *.so 文件。

如果我尝试使用 include $(BUILD_EXECUTABLE) 将源构建到命令行可执行文件中(基本上只是用命令行界面包装库),我在链接时遇到了以下错误:

out/target/product/flo/obj/lib/libssl.so: error: undefined reference to '__strlen_chk'
out/target/product/flo/obj/lib/libssl.so: error: undefined reference to '__strchr_chk'
out/target/product/flo/obj/lib/libcrypto.so: error: undefined reference to '__strrchr_chk'
out/target/product/flo/obj/lib/libcrypto.so: error: undefined reference to '__sprintf_chk'
out/target/product/flo/obj/lib/libcrypto.so: error: undefined reference to '__strcat_chk'

我看到了对这个问题的引用 herehere ,但我不确定如何修复它。我是否需要以不同方式构建 openssl 才能在可执行文件中工作?

更新

这就是我构建 openssl 的方式:

我没有遵循任何外部指示。我只是使用了 repo 中提供的内容。

最佳答案

尝试在构建时设置D_FORTIFY_SOURCE=0。我已经用 libcurl 解决了这个问题,在最后一部分中有详细信息 http://qiankanglai.me/misc/2014/08/31/android-libcurl/

关于android - libssl 和 libcrypto 的 undefined reference 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24047938/

相关文章:

openssl - 为什么签署证书需要 `-CAcreateserial` 参数?

c - libssh 绑定(bind)_接受错误 : Could not create BIO

android - 像 Android 蓝牙聊天示例中那样通过蓝牙传输文件

android - 最整洁的过滤交互器结果的方法

android - 从 Sqlite 设置多个警报

android - 将 Google Analytics 与 Robolectric(或 "Trying to use SQLite3 in Robolectric")一起使用时出现 SQLException

authentication - OpenSSL 是否有 GMAC API 和示例

ssl - 使用现有私钥创建 CSR

Debian/Linux 上的 Ruby 不支持的协议(protocol) (OpenSSL::SSL::SSLError)

Puma 服务器无法启动,libssl 错误 - 找不到文件