作者:庄蜗怕 | 来源:互联网 | 2023-09-16 18:54
首先到github上下载最新的代码。gitclonehttps:github.comopensslopenssl然后下载setenv-android.sh。用VisualStud
首先到github上下载最新的代码。
git clone https://github.com/openssl/openssl
然后下载 setenv-android.sh。 用Visual Studio Code改掉换行符。
参考https://www.jianshu.com/p/b790c548e787设置,我加上了arm64和x86_64的脚本。
然后,被提示无法继续编译,因为没有ANDROID_NDK的环境变量。我用Visual Studio Code搜索了才发现在/Configurations/15-android.conf中有读取ANDROID_NDK环境变量的选项,那不用说了,加上吧。
export ANDROID_NDK={your ndk path}
接着搜索并删除
-mandroid
最后一直坑了我两个小时,makefile中加上
LDFLAGS= -L{your ndk path}/toolchains/{eabi-toolchains}/prebuilt/linux-x86_64/lib/gcc/{eabi-toolchains}/4.9.x
否则开开心心make install的时候提示找不到-lgcc的。
上面是armeabi-v7a的。
接下来是arm64-v8a的。
./Configure no-shared no-ssl2 no-ssl3 no-comp no-hw no-engine android64-aarch64 --prefix={destdir}
x86
./Configure no-shared no-ssl2 no-ssl3 no-comp no-hw no-engine android-x86 --prefix={destdir}
x86_64
./Configure no-shared no-ssl2 no-ssl3 no-comp no-hw no-engine android64 --prefix={destdir}
12:00下班前2分钟搞定。