gpt4 book ai didi

android - 为 Android 构建 OpenSSH

转载 作者:行者123 更新时间:2023-12-03 09:47:51 24 4
gpt4 key购买 nike

注意:我浏览了大多数其他帖子,它们都使用旧版本的 NDK,这不适合我的用例。

我想为 Android 构建 OpenSSH 8.2。这是我为构建 zlib、OpenSSL 和最后的 OpenSSH 而编写的脚本。不幸的是,这似乎在决赛中失败了make .

#!/bin/bash

# set ANDROID_NDK_HOME
export ANDROID_NDK_HOME="/opt/android-ndk-r21b"

# add the toolchain to our path
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH"

# nb. for x86 set CHOST="i686-linux-android"
export CHOST="arm-linux-androideabi"
export CHOST2="armv7a-linux-androideabi29"
export CC="${CHOST2}-clang"
export CXX="${CHOST2}-clang++"
export RANLIB="${CHOST}-ranlib"
export LD="${CHOST}-ld"
export AR="${CHOST}-ar"
export ARFLAGS="cr"
export CHOST="${CHOST}"

# Build zlib
wget http://zlib.net/zlib-1.2.11.tar.gz
tar zxf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
cd ..

# Build OpenSSL
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
tar zxf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g
./Configure android-arm -D__ANDROID_API__=29
make
cd ..

# Build OpenSSH
#wget https://mirror.csclub.uwaterloo.ca/pub/OpenBSD/OpenSSH/portable/openssh-8.2p1.tar.gz
tar zxf openssh-8.2p1.tar.gz
cd openssh-8.2p1

./configure --host=arm-linux-androideabi --target=arm-linux-androideabi --with-libs --with-zlib=../zlib-1.2.11 --with-ssl-dir=../openssl-1.1.1g --disable-etc-default-login

make ssh

make ssh命令,构建失败:
make[1]: Entering directory '/home/edouard/ki4a_deps/openssh-8.2p1/openbsd-compat'
armv7a-linux-androideabi29-clang -g -O2 -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wimplicit-fallthrough -fno-strict-aliasing -mretpoline -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -fstack-protector-strong -fPIC -I. -I.. -I. -I./.. -I/home/edouard/ki4a_deps/openssh-8.2p1/../openssl-1.1.1g/include -I../zlib-1.2.11 -DHAVE_CONFIG_H -c arc4random.c
In file included from arc4random.c:34:
/opt/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/unistd.h:107:20: error: expected ')'
__attribute__((__sentinel__(1)));

这很奇怪,因为据我从谷歌搜索得知,clang 确实支持 __sentinel__ .我做错了什么?

最佳答案

为 Android 构建 openssh 命令行二进制文件。
上游:

https://github.com/CyanogenMod/android_external_zlib.git -b cm-11.0
https://github.com/CyanogenMod/android_external_openssl.git -b cm-11.0
https://github.com/CyanogenMod/android_external_openssh.git -b cm-11.0

更多信息在:
https://github.com/shmilee/android-cli-openssh

关于android - 为 Android 构建 OpenSSH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61451347/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com