NOTE: I went through most of the other posts, they all use an older version of the NDK which would not be ideal for my usecase.
I want to build OpenSSH 8.2 for Android. Here is the script I made to build zlib, OpenSSL and finally OpenSSH. Which unfortunately seems to fail at the final 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
On the make ssh
command, the build fails with:
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)));
Which is weird because as far as I can tell from Googling around, clang does support __sentinel__
. What did I do wrong?