【问题标题】:Undefined Reference Errors with libssl and libcryptolibssl 和 libcrypto 的未定义参考错误
【发布时间】:2014-06-04 21:31:35
【问题描述】:

我正在使用 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 中提供的内容。

【问题讨论】:

  • __strlen_chkFORTIFY_SOURCE 的一部分。您是如何构建 OpenSSL 的?您是否按照OpenSSL and Android 的说明进行操作?显示至少一个带有arm-linux-androideabi-gcc 的编译命令。你在用ANDROID_SYSROOT吗?
  • 我构建了作为 android-4.4_r1 一部分的 openssl。没有特殊选项,只是在我的项目中使用了 mmma。我不确定我是否在使用 ANDROID_SYSROOT(Android 新手)。

标签: android openssl libssl libcrypto fortify-source


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多