Ubuntu 64系统编译android arm64-v8a 的openssl静态库libssl.a和libcrypto.a
#!/bin/bash
# Cross-compile environment for Android on ARM64 and x86
#
# Contents licensed under the terms of the OpenSSL license
# http://www.openssl.org/source/license.html
#
# See http://wiki.openssl.org/index.php/FIPS_Library_and_Android
# and http://wiki.openssl.org/index.php/Android ##################################################################### # Set ANDROID_NDK_ROOT to your NDK location. For example,
# /opt/android-ndk-r8e or /opt/android-ndk-r9. This can be done in a
# login script. If ANDROID_NDK_ROOT is not specified, the script will
# try to pick it up with the value of _ANDROID_NDK_ROOT below. If
# ANDROID_NDK_ROOT is set, then the value is ignored.
_ANDROID_NDK="android-ndk-r14b"
# _ANDROID_NDK="android-ndk-r10" # Set _ANDROID_EABI to the EABI you want to use. You can find the
# list in $ANDROID_NDK_ROOT/toolchains. This value is always used.
_ANDROID_EABI="aarch64-linux-android-4.9" # Set _ANDROID_ARCH to the architecture you are building for.
_ANDROID_ARCH=arch-arm64 # Set _ANDROID_API to the API you want to use. You should set it
# to one of: android-14, android-9, android-8, android-14, android-5
# android-4, or android-3. You can't set it to the latest (for
# example, API-17) because the NDK does not supply the platform.
_ANDROID_API="android-24" ##################################################################### # If the user did not specify the NDK location, try and pick it up.
if [ -z "$ANDROID_NDK_ROOT" ]; then _ANDROID_NDK_ROOT=""
if [ -d "/usr/local/$_ANDROID_NDK" ]; then
_ANDROID_NDK_ROOT="/usr/local/$_ANDROID_NDK"
fi if [ -d "/opt/$_ANDROID_NDK" ]; then
_ANDROID_NDK_ROOT="/opt/$_ANDROID_NDK"
fi if [ -d "$HOME/$_ANDROID_NDK" ]; then
_ANDROID_NDK_ROOT="$HOME/$_ANDROID_NDK"
fi if [ -d "$PWD/$_ANDROID_NDK" ]; then
_ANDROID_NDK_ROOT="$PWD/$_ANDROID_NDK"
fi # If a path was set, then export it
if [ ! -z "$_ANDROID_NDK_ROOT" ] && [ -d "$_ANDROID_NDK_ROOT" ]; then
export ANDROID_NDK_ROOT="$_ANDROID_NDK_ROOT"
fi
fi # Error checking
if [ -z "$ANDROID_NDK_ROOT" ] || [ ! -d "$ANDROID_NDK_ROOT" ]; then
echo "Error: ANDROID_NDK_ROOT is not a valid path. Please edit this script."
exit 1
fi if [ ! -d "$ANDROID_NDK_ROOT/toolchains" ]; then
echo "Error: ANDROID_NDK_ROOT/toolchains is not a valid path. Please edit this script."
exit 1
fi if [ ! -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI" ]; then
echo "Error: ANDROID_EABI is not a valid path. Please edit this script."
exit 1
fi ##################################################################### # Based on ANDROID_NDK_ROOT, try and pick up the required toolchain.
ANDROID_TOOLCHAIN=""
for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86"
do
if [ -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin" ]; then
ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin"
break
fi
done # Error checking
if [ -z "$ANDROID_TOOLCHAIN" ] || [ ! -d "$ANDROID_TOOLCHAIN" ]; then
echo "Error: ANDROID_TOOLCHAIN is not valid. Please edit this script."
exit 1
fi case $_ANDROID_ARCH in
arch-arm)
ANDROID_TOOLS="arm-linux-androideabi-gcc arm-linux-androideabi-ranlib arm-linux-androideabi-ld"
CROSS_COMPILE="arm-linux-androideabi-"
;;
arch-arm64)
ANDROID_TOOLS="aarch64-linux-android-gcc aarch64-linux-android-ranlib aarch64-linux-android-ld"
CROSS_COMPILE="aarch64-linux-android-"
;;
arch-x86)
ANDROID_TOOLS="i686-linux-android-gcc i686-linux-android-ranlib i686-linux-android-ld"
CROSS_COMPILE="i686-linux-android-"
;;
*)
echo "ERROR ERROR ERROR: Unknown architecture $_ANDROID_ARCH"
exit 1
;;
esac for tool in $ANDROID_TOOLS
do
# Error checking
if [ ! -e "$ANDROID_TOOLCHAIN/$tool" ]; then
echo "Error: Failed to find $tool. Please edit this script."
exit 1
fi
done # Only modify/export PATH if ANDROID_TOOLCHAIN is good
if [ ! -z "$ANDROID_TOOLCHAIN" ]; then
export ANDROID_TOOLCHAIN="$ANDROID_TOOLCHAIN"
export PATH="$ANDROID_TOOLCHAIN":"$PATH"
fi ##################################################################### # For the Android SYSROOT. Can be used on the command line with --sysroot
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
export CROSS_SYSROOT="$ANDROID_SYSROOT"
export NDK_SYSROOT="$ANDROID_SYSROOT" # Error checking
if [ -z "$ANDROID_SYSROOT" ] || [ ! -d "$ANDROID_SYSROOT" ]; then
echo "Error: ANDROID_SYSROOT is not valid. Please edit this script."
exit 1
fi ##################################################################### # Set other environment variables for the build
export MACHINE=aarch64
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=arm64
export CROSS_COMPILE="aarch64-linux-android-" export ANDROID_DEV="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr"
export HOSTCC=gcc VERBOSE=1
if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" != "0" ]; then
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
echo "ANDROID_ARCH: $_ANDROID_ARCH"
echo "ANDROID_EABI: $_ANDROID_EABI"
echo "ANDROID_API: $ANDROID_API"
echo "ANDROID_SYSROOT: $ANDROID_SYSROOT"
echo "ANDROID_TOOLCHAIN: $ANDROID_TOOLCHAIN"
echo "CROSS_COMPILE: $CROSS_COMPILE"
echo "ANDROID_DEV: $ANDROID_DEV"
fi
上面的代码是 配置的OpenSSL 编译选项(shell 脚本)。复制代码后另存为Setenv-android.sh。
Openssl 源码库下载链接:
1、开始编译
终端设置ndk 路径: export ANDROID_NDK_ROOT=/home/lipan/androidsdk/android-ndk-r14b
2、执行shell 脚本:source 命令
将Setenv-android.sh 移动到 openssl 源代码文件夹终,然后在此处启动终端,输入:source ./Setenv-android.sh
3、创建输出静态库的文件夹 (桌面路径)
mkdir /home/lipan/Desktop/output/
4、清理
make clean
5、配置openssl
./Configure android-arm64 \
no-shared \
no-ssl2 \
no-ssl3 \
no-comp \
no-hw \
no-engine \
--openssldir=/home/lipan/Desktop/output/$ANDROID_API \
--prefix=/home/lipan/Desktop/output/$ANDROID_API
6、编译(下面这2句代码都是对的)
make depend
make all -j$(nproc)make all -j$(nproc)
命令用于在编译软件时启用并行化,以利用系统中的多个 CPU 核心-j$(nproc)
:-j
标志用于指定同时运行的作业(或进程)数量。$(nproc)
是一个 shell 命令,它返回可用的处理单元数量(即 CPU 核心数量)
当你运行make all -j$(nproc)
时,它会告知make
使用与 CPU 核心数量相等的并行作业,这样可以显著加快构建过程。
7、最后一步:生成静态库
make install

Ubuntu 64系统编译android arm64-v8a 的openssl静态库libssl.a和libcrypto.a的更多相关文章
- android ndk-build 编译静态库libxx.a 以及Android studio openssl 静态库配置(cmake)
android ndk-build 编译静态库libxx.a 需求场景: 目前有安卓编码好的现在的openssl的两个.a,我们需要调用openssl的函数,并把功能再封装成.a; 这样使用时,在an ...
- 【转】iOS编译OpenSSL静态库(使用脚本自动编译)
原文网址:https://www.jianshu.com/p/651513cab181 本篇文章为大家推荐两个脚本,用来iOS系统下编译OpenSSL通用库,如果想了解编译具体过程,请参看<iO ...
- Ubuntu 14.04 编译 Android 4.2.2 for Tiny4412
. . . . . 在学校里是用 Redhat 6.4 编译的 Android 4.2.2 很顺利,把源码包拷贝到笔记本上的 Ubuntu 14.04 上再编译遭遇了各种坑,所以便有了这篇博客记录解决 ...
- [原]Ubuntu 14.04编译Android Kernel
如何编译android kernel参考官方文档:https://source.android.com/source/building-kernels.html 在Ubuntu 14.04上编译a ...
- android编译openssl静态库.a
github上有一个开源项目,已经为你编译openssl建好了工程. 地址:https://github.com/aluvalasuman/OpenSSL1.0.1cForAndroid 选择需要的版 ...
- iOS开发~制作同时支持armv7,armv7s,arm64,i386,x86_64的静态库.a
一.概要 平时项目开发中,可能使用第三方提供的静态库.a,如果.a提供方技术不成熟,使用的时候就会出现问题,例如: 在真机上编译报错:No architectures to compile for ( ...
- iOS开发~制作同时支持armv7,armv7s,arm64,i386,x86_64的静态库.a以及 FrameWork 的创建
armv7,armv7s,arm64,i386,x86_64 详解 一.概要 平时项目开发中,可能使用第三方提供的静态库.a,如果.a提供方技术不成熟,使用的时候就会出现问题,例如: 在真机上编译报错 ...
- Android NDK生成及连接静态库与动态库
对于Android应用开发,大部分情况下我们使用Java就能完整地实现一个应用.但是在某些情况下,我们需要借助C/C++来写JNI本地代码.比如,在使用跨平台的第三方库的时候:为了提升密集计算性能的时 ...
- VS2010编译链接openssl静态库
最近工作需要使用一些加密算法.之前尝试过cryptopp以及polarssl,听说openssl中的加密模块特别全,并且特别好用.于是想尝试一下. 一.环境配置 下载openssl,我这里使用的是op ...
- VS2012(update3)编译Qt5.1.1 32位静态库debug-and-release版及结果分享
1. 下载zip源码,我下载的是qt-everywhere-opensource-src-5.1.1.zip这个文件. 2.安装python 3.解压缩qt-everywhere-opensource ...
随机推荐
- 火山引擎ByteHouse发布高性能全文检索引擎
更多技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流群. 随着数字时代的发展,数据的来源和生成方式越来越广泛,数据形态也愈加丰富. 以某电商平台的数据情况举例.该电 ...
- webpack4.15.1 学习笔记(十) — 常见 loader 使用
目录 style -loader <= css-loader <= less-loader postcss-loader file-loader url-loader html-withi ...
- Python爬虫(5-10)-编解码、ajax的get请求、ajax的post请求、URLError/HTTPError、微博的cookie登录、Handler处理器
五.编解码(Unicode编码) (1)GET请求 所提方法都在urllib.parse.路径下 get请求的quote()方法(适用于只提交一两个参数值) url='http://www.baidu ...
- 《最新出炉》系列初窥篇-Python+Playwright自动化测试-62 - 判断元素是否可操作
1.简介 有些页面元素的生命周期如同流星一闪,昙花一现.我们也不知道这个元素在没在页面中出现过,为了捕获这一美好瞬间,让其成为永恒.我们就来判断元素是否显示出现过. 在操作元素之前,可以先判断元素的状 ...
- 【Zookeeper】01 概述 & 基础部署
背景: 随着互联网技术的发展,企业对计算机系统的计算,存储能力要求越来越高,各大IT企业都在追求高并发,海量存储的极致, 在这样的背景下,单纯依靠少量高性能单机来完成计算机,云计算的任务已经无法满足需 ...
- 2024-08-03:用go语言,给定一个从 0 开始的字符串数组 `words`, 我们定义一个名为 `isPrefixAndSuffix` 的布尔函数,该函数接受两个字符串参数 `str1` 和
2024-08-03:用go语言,给定一个从 0 开始的字符串数组 words, 我们定义一个名为 isPrefixAndSuffix 的布尔函数,该函数接受两个字符串参数 str1 和 str2. ...
- 【转载】 优必选悉尼 AI 研究院何诗怡:基于课程学习的强化多标签图像分类算法 | 分享总结
原文地址: https://baijiahao.baidu.com/s?id=1603057342167437458&wfr=spider&for=pc 来源"雷锋网&quo ...
- 如何在无窗口模式下为git的tag和commit操作加GPG私钥——如何在命令行模式下使用gpg秘钥为git操作签名
相关: 如何在无窗口模式下运行GPG--如何在命令行模式下使用gpg生成秘钥:How to make gpg prompt for passphrase on CLI--GPG prompt for ...
- Cython.Compiler.Errors.CompileError: Cython.Compiler.Errors.CompileError: /home/devil/anaconda3/envs/chainerRL/lib/python3.6/site-packages/mujoco_py/cymj.pyx
ubuntu系统下,python3.6,anaconda下配置mujoco210环境时遇到报错: /home/devil/anaconda3/envs/chainerRL/lib/python3.6/ ...
- Vue Vine:带给你全新的 Vue 书写体验!
你好,我是 Kagol,个人公众号:前端开源星球. 上个月和 TinyVue 的小伙伴们一起参加了 VueConf 24 大会,有幸认识沈青川大佬,并了解了他的 Vue Vine 项目,Vue Vin ...