How to compile OpenSSH for ARM?

I am trying to compile OpenSSH using the Android NDK, but failed.

My attempt consists of the following steps:

  • cross compile OpenSSL for Android and set the headers / libraries to /home/me/arm

  • grab openssh 6.2p1 from here

  • extract the archive and run ./configure :

      ./configure --prefix = / home / me / arm \
             --host = arm-linux-androideabi \
             --with-ssl-dir = / home / me / arm 

    ... which led to the following error:

      getrrsetbyname.c: 166: 2: error: unknown type name 'HEADER' 
  • change the ./configure command to include:

      ac_cv_search_getrrsetbyname = yes 

    ... which fixed one problem, but still aborted with another error:

      /usr/include/linux/un.h:17:8: error: redefinition of 'struct sockaddr_un' 
  • change the ./configure command again to include:

      ac_cv_header_sys_un_h = yes 

    ... which even bigger me, but still interrupted with an error:

      channels.c: In function 'channel_prepare_select':
     channels.c: 2143: 2: warning: implicit declaration of function 'howmany'
     [-Wimplicit-function-declaration]
     channels.c: 2145: 45: error: 'fd_mask' undeclared (first use in this function) 

Now i'm stuck. I opened Android sys/select.h and found that fd_mask not defined anywhere . I also could not find the ./configure option to get around this. There is also a problem with howmany() undefined.

What changes do I need to make the program compile?


Edit: Now I have managed to do a little work. I added the following line to ./configure to skip the error "undefined fd_mask ":

  --with-cflags = -Dfd_mask = int 

Then I got the following error:

  error: 'struct passwd' has no member named 'pw_gecos' 

Android passwd struct has no pw_gecos member. This could not be fixed without creating the actual patch for the source code. The patch is here .

Now I am stuck with the following error:

  dns.c: In function 'dns_result_totext':
 dns.c: 56: 7: error: 'ERRSET_SUCCESS' undeclared (first use in this function)
 dns.c: 56: 7: note: each undeclared identifier is reported only once for each
   function it appears in
 dns.c: 58: 7: error: 'ERRSET_NOMEMORY' undeclared (first use in this function)
 ... 

Edit: I made some changes to the patch above that fix quite a few bugs so far. I also added ldns . The configure command now looks like this:

  patch -p0 <openssh.patch;
 autoconf;
 ./configure --prefix = / home / me / arm \
             --host = arm-linux-androideabi \
             --with-ldns = / home / me / arm \
             --with-ssl-dir = / home / me / arm \
             ac_cv_header_sys_un_h = yes 

... and here is a new patch. Now I get the following errors:

  loginrec.c: In function 'construct_utmp':
 loginrec.c: 665: 17: error: 'DEAD_PROCESS' undeclared (first use in this function)
 loginrec.c: 665: 17: note: each undeclared identifier is reported only once for
   each function it appears in
 loginrec.c: At top level:
 loginrec.c: 727: 45: warning: 'struct utmpx' declared inside parameter list
   [enabled by default] 
+4
source share

All Articles