【问题标题】:Problems building OpenSSL 1.1.0c for Android against NDK 15.2针对 NDK 15.2 为 Android 构建 OpenSSL 1.1.0c 的问题
【发布时间】:2017-11-02 10:08:55
【问题描述】:

在运行 build-openssl-libraries.sh 时,我遇到了以下问题:

运行时发出警告。/在第 48 行配置 dist:

The library could not be configured for supporting multi-threaded
applications as the compiler options required on this system are not known.
See file INSTALL for details if you need multi-threading.

The options 'shared', 'pic' and 'dynamic-engine' aren't supported on this
platform, so we will pretend you gave the option 'no-pic', which also disables
'shared' and 'dynamic-engine'.  If you know how to implement shared libraries
or position independent code, please let us know (but please first make sure
you have tried with a current version of OpenSSL).

运行 build/tools/make-standalone-toolchain.sh @line 75 时出错:

HOST_OS=darwin
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=darwin-x86_64
HOST_NUM_CPUS=4
BUILD_NUM_CPUS=8
ERROR: Failed to create toolchain.

由于此错误,.c 文件的后续编译失败,提示找不到 stdlib.h。

请帮助我了解如何成功构建它...在 Android 上我需要多线程支持。

  • 忽略这两个 ./Configure 警告有什么影响
  • 如何让Make toolchain成功?

我在 macOS Sierra 10.12.6 上运行。这是构建 SQLCipher 的一部分。

【问题讨论】:

  • 您使用什么过程来构建适用于 Android 的 OpenSSL 库?请提供文档链接。
  • @jww 请参阅此链接:zetetic.net/sqlcipher/open-source。基本上按照上面的方法克隆并按照 README.org 中的说明进行操作。但这并不顺利。但是,如果您只想要 Android 的 SQLCipher 而无需更改,您可以根据zetetic.net/sqlcipher/sqlcipher-for-android 包含 compile 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
  • @jww 如果您询问是否仅构建 OpenSSL,则克隆上述 git 后会有一个 shell 脚本 build-openssl-libraries.sh ..

标签: macos build openssl sqlcipher


【解决方案1】:

我已经更新了构建 OpenSSL 的构建脚本,目前使用 Android NDK r15c for SQLCipher for Android here。你会试试看吗?

【讨论】:

  • 我设法构建它..链接问题是因为 NDK15 已弃用东西..并且有一个标志要覆盖..我仍然会尝试更新的脚本并返回..谢谢..
  • 知道 SQLCipher 是否会升级到最新版本的 SQLite?目前它基于 3.15.2 而 SQLite 已经发布了 3.21+..
  • 我全新克隆并运行 make init 并遇到以下问题: (1) android update project -p /Users/arun/test/android-database-sqlcipher Error: The project or has no target set或目标无效。请为“android 更新”命令提供 --target。 (2) 由于 ./Configure dist 的警告仍然存在。 (3) 仍然显示 ERROR: Failed to create toolchain。之后它在 aes.c 编译期间失败,显示 /bin/sh: arm-linux-androideabi-gcc: command not found
  • 试试gradle 分支。
  • 我看到你正在升级到 3.20.1... 我刚刚克隆了 android-database-sqlcipher 并运行了“make build”。但是遇到问题:android-database-sqlcipher:buildNative FAILED 当我在 gradle 调试模式下运行时,它在编译 sqlite3.c 时会出现很多错误,开头是:[armeabi] 编译拇指:sqlcipher
【解决方案2】:

当我将“./Configure dist”行更改为“./Configure android”时,这两个警告消失了。

make 工具链问题是因为参数传递 android-9 而 NDK15 仅支持 android-14。正如有人建议的那样,这是通过为 make-toolchain 命令启用 --verbose 发现的。

现在脚本编译所有 .c 文件,但在链接期间遇到问题(apps/openssl.o:openssl.c:function main: error: undefined reference to 'stpcpy')。看起来配置或 NDK 配置又出现了一些问题..

为可能面临相同问题的任何人提供答案..

【讨论】:

    猜你喜欢
    • 2012-08-05
    • 2014-09-01
    • 2011-02-26
    • 1970-01-01
    • 2012-05-04
    • 2013-08-16
    • 1970-01-01
    • 2012-03-30
    • 2013-03-25
    相关资源
    最近更新 更多