如何交叉编译OpenSSH for ARM?

时间:2013-04-03 19:28:40

标签: android android-ndk arm cross-compiling openssh

我正在尝试使用Android NDK编译OpenSSH,但失败了。

我的尝试包括以下步骤:

  1. 交叉编译OpenSSL for Android并将标题/库安装到/home/me/arm

  2. here

  3. 抓取OpenSSH 6.2p1
  4. 提取存档并运行./configure

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

    ...导致以下错误:

    getrrsetbyname.c:166:2: error: unknown type name 'HEADER'
  5. 修改./configure命令以包含:

    ac_cv_search_getrrsetbyname=yes

    ...修复了一个问题,但仍然因另一个错误而中止:

    /usr/include/linux/un.h:17:8: error: redefinition of 'struct sockaddr_un'
  6. 再次修改./configure命令 以包含:

    ac_cv_header_sys_un_h=yes

    ...这让我更进一步,但仍然因错误而中止:

    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)
  7. 现在我被卡住了。我已经破解了Android sys/select.h并发现了fd_mask isn't defined anywhere。我也找不到./configure选项来解决这个问题。还有howmany()未定义的问题。

    我需要做些什么更改才能让程序编译?


    编辑:我现在设法得到了更多。我已将以下行添加到./configure以超越"未定义fd_mask"错误:

    --with-cflags=-Dfd_mask=int

    然后我收到以下错误:

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

    Android passwd结构没有pw_gecos成员。如果没有为源代码创建实际补丁,则无法纠正此问题。补丁是here

    我现在遇到以下错误:

    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)
    ...

    编辑:我已对上面的补丁进行了一些修改,从而消除了目前为止的一些错误。我还添加了ldns。 configure命令现在如下所示:

    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

    ...而here是新补丁。我现在得到的错误是:

    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]

0 个答案:

没有答案