简体   繁体   中英

Cross-compiling OpenSSH for Android fails in getrrsetbyname.c

I'm trying to cross-compile OpenSSH 7.6p1 for Android. It fails in getrrsetbyname.c . Here's the clang-output for that file:

(cd openbsd-compat && /Applications/Xcode.app/Contents/Developer/usr/bin/make)
/Users/johannes/src/android_ssh/android_ndk_arm_api21/bin/clang -I/Users/johannes/src/android_ssh/prefix/include -pipe -Qunused-arguments -Wunknown-warning-option -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -fno-builtin-memset -fstack-protector-strong   -I. -I.. -I. -I./.. -I~/src/android_ssh/prefix/include/openssl  -DHAVE_CONFIG_H -c getrrsetbyname.c
getrrsetbyname.c:219:12: error: incomplete definition of type 'struct state'
        if ((_resp->options & RES_INIT) == 0 && res_init() == -1) {
             ~~~~~^
getrrsetbyname.c:71:8: note: forward declaration of 'struct state'
struct __res_state _res;
       ^
../config.h:1785:21: note: expanded from macro '__res_state'
#define __res_state state
                    ^
getrrsetbyname.c:219:24: error: use of undeclared identifier 'RES_INIT'
        if ((_resp->options & RES_INIT) == 0 && res_init() == -1) {
                              ^
getrrsetbyname.c:71:20: error: tentative definition has type 'struct state' that is never completed
struct __res_state _res;
                   ^
getrrsetbyname.c:71:8: note: forward declaration of 'struct state'
struct __res_state _res;
       ^
../config.h:1785:21: note: expanded from macro '__res_state'
#define __res_state state
                    ^
3 errors generated.
make[1]: *** [getrrsetbyname.o] Error 1
make: *** [openbsd-compat/libopenbsd-compat.a] Error 2

So it's missing a constant ( RES_INIT ) and a struct ( struct __res_state ) which are, at least on macOS and probably also on Linux, defined in the system resolv.h. However, the resolv.h in Android's NDK doesn't define those.

Am I missing something, or is getrssetbyname.c just not compatible in its current form with Android NDK?

如果有人对用于Android的OpenSSH交叉编译感兴趣,我建议看一下Termux项目,尤其是termux-packages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM