- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我之前问过基本相同的问题(不同的 NDK)here并认为我正确构建了 openssl,但是当我开始尝试将它链接到我的应用程序时,我发现我没有正确构建它。
如果我桥接来自@AlexCohn 的答案 here我从 setenv_android.sh
脚本开始。
我修改脚本以设置 THE_ARCH=arm64-v8a
以尝试针对 64 位 android 架构。
当我运行脚本时,它找不到一些东西:
ERROR: Failed to find Android cpp. Please edit this script.
ERROR: Failed to find Android gcc. Please edit this script.
ERROR: Failed to find Android g++. Please edit this script.
ERROR: AOSP_STL_INC is not valid. Please edit this script.
ERROR: AOSP_STL_LIB is not valid. Please edit this script.
ANDROID_NDK_ROOT: /Users/spartygw/android-ndk-r19/
AOSP_TOOLCHAIN_PATH: /Users/spartygw/android-ndk-r19//toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin
AOSP_ABI: arm64-v8a
AOSP_API: android-21
AOSP_SYSROOT: /Users/spartygw/android-ndk-r19//platforms/android-21/arch-arm64
AOSP_FLAGS: -funwind-tables -fexceptions -frtti
AOSP_STL_INC: /Users/spartygw/android-ndk-r19//sources/cxx-stl/stlport/stlport/
AOSP_STL_LIB: /Users/spartygw/android-ndk-r19//sources/cxx-stl/stlport/libs/arm64-v8a/libstlport_shared.so
当我查看 /Users/spartygw/android-ndk-r19//toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin
时,没有 aarch64-linux-android-cpp
或 -gcc
或 -g++
正如脚本输出所说:
$ ls -1 ~/android-ndk-r19//toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin
./
../
aarch64-linux-android-addr2line
aarch64-linux-android-ar
aarch64-linux-android-as
aarch64-linux-android-c++filt
aarch64-linux-android-dwp
aarch64-linux-android-elfedit
aarch64-linux-android-gprof
aarch64-linux-android-ld
aarch64-linux-android-ld.bfd
aarch64-linux-android-ld.gold
aarch64-linux-android-nm
aarch64-linux-android-objcopy
aarch64-linux-android-objdump
aarch64-linux-android-ranlib
aarch64-linux-android-readelf
aarch64-linux-android-size
aarch64-linux-android-strings
aarch64-linux-android-strip
我认为这是我上次惹麻烦的地方。我开始破解脚本以获得似乎有效的东西,现在我确定我所做的是错误的。
我真的不明白这个过程,所以我希望得到帮助。有人成功构建了 arm64-v8a 版本的 OpenSLL 吗?
最佳答案
我能够使用 NDK r19 为 android arm64 构建、链接和运行 openssl。但我不得不使用从 android-ndk-r19 生成的独立工具链。
$ cd /path/to/android-ndk-r19
$ ./build/tools/make-standalone-toolchain.sh \
--toolchain=aarch64-linux-android
这将在您的 tmp 目录中生成一个名为 aarch64-linux-android 的目录,将其 bin 目录放入您的路径中。此外,将您的 ANDROID_NDK_HOME 设置为此位置。
$ export PATH=/path/to/aarch64-linux-android/bin:${PATH}
$ export ANDROID_NDK_HOME=/path/to/aarch64-linux-android
然后只需运行 openssl 的 Configure 和 make。
$ cd /path/to/openssl1.1.1
$ ./Configure android-arm64
$ make
./Configure 的输出如下:
$ ./Configure android-arm64
Configuring OpenSSL version 1.1.1b-dev (0x10101020L) for android-arm64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL file first) ***
*** ***
**********************************************************************
$
最后,我创建了一个新的 Android Studio 项目,带有 c++11、异常和 rtti 支持(通过新项目向导),并在构建的输出中链接了一个 CMakeLists.txt,该文件稍作修改由 Android Studio 创建:
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/native-lib.cpp )
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
# HERE ARE THE PARTS I EDITED:
# NOTE FOR THE COMMANDS ABOVE, THIS IS JUST THE OPENSSL SOURCE DIR.
set (SSL_PATH /path/to/ssl/build/outputs/)
include_directories(${SSL_PATH}/include)
set (open-ssl-libs ${SSL_PATH}/libssl.a ${SSL_PATH}/libcrypto.a)
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
native-lib
# LINK SSL AND CRYPTO HERE:
${open-ssl-libs}
# Links the target library to the log library
# included in the NDK.
${log-lib} )
这足以表明它有链接,但我在 Android Studio 生成的样板 C++ 代码中添加了一个对 libssl.a 的小引用:
#include <jni.h>
#include <string>
#include <openssl/ssl.h>
extern "C" JNIEXPORT jstring JNICALL
Java_com_vernier_android_test_1ssl_MainActivity_stringFromJNI(
JNIEnv* env,
jobject /* this */) {
SSL* ssl = SSL_new(nullptr);
std::string hello = "Hello from C++";
return env->NewStringUTF(hello.c_str());
}
我成功运行了该应用程序。
关于android - 如何使用 NDK 19 在 OSX Darwin 上为 64 位 Android 交叉编译 OpenSSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54656695/
我想使用单个(交叉)编译器来编译不同 ARM 调用约定的代码:因为我总是想使用浮点和 NEON 指令,所以我只想选择硬浮点调用约定或软浮点(softfp)调用约定。 我的编译器默认为硬浮点,但它支持我
假设我正在构建一个依赖于两个库的 java 应用程序:A 和 B。A 和 B 都依赖于库 C。管理 A 和 B 使用相同版本的最佳方法是什么所以他们不冲突?我正在使用 Gradle。 最佳答案 从 G
我想在按钮的文本上添加图像。如果我将图像添加为按钮的背景,它就会添加到文本下方。预期结果作为图像添加。请帮忙 更新:我需要以编程方式执行此操作。 最佳答案 在 XML 中, * 在代码中
我已经开始使用 CSS3 制作动画了。 我尝试创建一个动画汉堡菜单,但结果有点难看。顶部和底部的条向右平移一点。所以旋转动画不是很流畅和正确。 这是结果 => 这是我的代码: /* HTML */
给定一个具有2条相交曲线的图像,如下图所示,我如何使用opencv或python检测和区分2条曲线? (所以我需要2条单独的曲线) 最佳答案 您可以扫描每一列,并从连接的零件中识别出簇。 伪算法: l
我正在尝试在 redhat 集群(x86_64 主机)上设置 cross-mingw。我没有 root 访问权限,并且可用的 mingw 二进制文件不起作用(坏 glibc 版本等)。我正在阅读本教程
我正在尝试在javaFX中开发一个游戏,当两个图像相交时,分数将被更新,并且障碍物将不可见。但不幸的是,在游戏中分数不断更新。 我想我无法在游戏中正确地使图像不可见。 以下是相关类的完整代码: pac
pikastar dot com 是网站,当向下滚动它然后在导航菜单展开固定位置时它 > 将穿过主 div。我该如何修复它。 #topNav.sticky { box-shadow: 0 10
我正在使用 Eclipse为 ARM 处理器交叉编译 g++ 项目。我在 Windows 环境中使用 yagarto 工具链。我对 C 项目没有问题,但是对于 C++,我一直收到错误: libc.a(
我想从两个哈希数组中获取并集/交集/差集,例如: array1 = [{:name =>'Guy1', :age => 45},{:name =>'Guy2', :age => 45}] array2
有没有办法在调用任何 Controller 操作之前执行一些代码? 我需要根据 get 参数的值设置 session 变量,而不考虑调用哪个 Controller 。 当然,一旦这个处理完成,请求需要
我刚开始使用 3D 网格,面向用于有限元分析。我想在立方体状矩阵中模拟 Material 的夹杂物(任何形状,但主要对球体和椭圆体感兴趣)。这些夹杂物不应彼此重合。 所以我想为python使用某种包,
我想知道以跨平台方式操作应用程序设置的最佳解决方案是什么。 在 iOS 中,我们可以在设置屏幕中更改应用程序外部的设置,但在 windows phone 和 android 中我们没有。 所以,我的想
var barcodeNum = ko.observable(""); VelocityMeetings.scan = function (params) { var errorMessage = k
这个问题在这里已经有了答案: Transforming data.frame in R (2 个答案) 关闭10 年前。 过去我问过一个关于如何create cross tables from a
我有两个共享同一个工厂的 Controller 。其中一个 Controller 正在更新工厂变量。其他人应该注意该变化并稍后显示。 我是这样尝试的: http://plnkr.co/edit/q1N
标题不好,但这是我发现的将我的问题与简单的表格交叉区分开来的方式,因为我之前的研究总是让我接触到这类主题。 我有几个表 - 为了简化起见,我们只用 3 个表来命名它们:A、B、C。我想将它们全部放在一
我需要做这样的事情(在 MySQL 中),我使用 UNION 的尝试直到现在才奏效。 理论上: SELECT * FROM tableA A JOIN tableB B ON A.tableAId =
注意:使用SDL 2.0,Cross header class问题 我在类之间进行交叉引用,主要是我的类初始化渲染器和我的纹理类引用渲染初始化。现在,我已经能够运行该程序,直到我开始放入纹理类,代码也
我有一个这样的字母数组 var letters = ["Y", "X", "A", "Y", "O", "H", "A", "O", "O"]; 我创建了一个循环来
我是一名优秀的程序员,十分优秀!