V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
xseven007
V2EX  ›  Android

有用 android NDK 成功编译 Redsocks2 的么?

  •  
  •   xseven007 · 2016-08-19 21:50:13 +08:00 · 10350 次点击
    这是一个创建于 3035 天前的主题,其中的信息可能已经有所发展或是发生改变。

    有用 android NDK 成功编译[Redsocks2]: https://github.com/semigodking/redsocks 的么? 我按照 github 上 WIKI 上的[编译方法] :https://github.com/semigodking/redsocks/wiki/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8Android-NDK%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91redsocks2 找到那几个.c 文件,并且按照上面的方法进行了操作,但是 ndk-build 的时候出现了以下错误。

    [armeabi] Compile thumb : redsocks <= main.c

    /opt/src/redsocks/android/jni/openssl/ssl/../../../../main.c: In function 'wait_for_network':

    /opt/src/redsocks/android/jni/openssl/ssl/../../../../main.c:95:25: error: 'IPPROTO_TCP' undeclared (first use in this function)

    hints.ai_protocol = IPPROTO_TCP; /* We want a TCP socket /

    ^

    /opt/src/redsocks/android/jni/openssl/ssl/../../../../main.c:95:25: note: each undeclared identifier is reported only once for each function it appears in /usr/local/android-ndk/build/core/build-binary.mk:472: recipe for target '/opt/src/redsocks/android/obj/local/armeabi/objs/redsocks/main.o' failed

    make: ** [/opt/src/redsocks/android/obj/local/armeabi/objs/redsocks/main.o] Error 1

    各位 V 友有什么解决方法么?
    7 条回复    2016-08-20 16:59:39 +08:00
    rphoho
        1
    rphoho  
       2016-08-19 23:05:49 +08:00
    proxydroid 里的有,编得过。
    allenforrest
        2
    allenforrest  
       2016-08-19 23:11:24 +08:00
    想省事:
    #define IPPROTO_TCP 6 /* tcp */
    xseven007
        3
    xseven007  
    OP
       2016-08-20 11:45:48 +08:00
    @rphoho proxydroid 里面的应该是 redsocks 原版吧?
    xseven007
        4
    xseven007  
    OP
       2016-08-20 12:09:44 +08:00
    @allenforrest main.c 过了,然后后面又出现了一系列的问题
    /opt/src/redsocks/android/jni/openssl/ssl/../../../../redudp.c:159:13: warning: 'bound_udp4_put' defined but not used [-Wunused-function]
    static void bound_udp4_put(const struct sockaddr_in *addr)
    ^
    /usr/local/android-ndk/build/core/build-binary.mk:472: recipe for target '/opt/src/redsocks/android/obj/local/armeabi/objs/redsocks/redudp.o' failed
    xseven007
        5
    xseven007  
    OP
       2016-08-20 12:22:22 +08:00
    @allenforrest 应该是 alltypes.h 的问题,但是换成某个 arm 的 alltypes.h 之后又会出现
    In file included from /opt/src/redsocks/android/jni/openssl/ssl/../../../../socks5-udp.c:26:0:
    /opt/src/redsocks/android/jni/openssl/ssl/../../../../redudp.h:29:21: error: field 'bindaddr' has incomplete type
    struct sockaddr_in bindaddr;
    ^
    /opt/src/redsocks/android/jni/openssl/ssl/../../../../redudp.h:30:21: error: field 'relayaddr' has incomplete type
    struct sockaddr_in relayaddr;
    ^
    /opt/src/redsocks/android/jni/openssl/ssl/../../../../redudp.h:32:21: error: field 'destaddr' has incomplete type
    struct sockaddr_in destaddr;
    ^
    /opt/src/redsocks/android/jni/openssl/ssl/../../../../redudp.h:53:22: error: field 'clientaddr' has incomplete type
    struct sockaddr_in clientaddr;
    ^
    /opt/src/redsocks/android/jni/openssl/ssl/../../../../redudp.h:54:22: error: field 'destaddr' has incomplete type
    struct sockaddr_in destaddr;
    ^
    /opt/src/redsocks/android/jni/openssl/ssl/../../../../redudp.h:66:21: error: field 'destaddr' has incomplete type
    struct sockaddr_in destaddr;
    ^
    /usr/local/android-ndk/build/core/build-binary.mk:472: recipe for target '/opt/src/redsocks/android/obj/local/armeabi/objs/redsocks/socks5-udp.o' failed
    make: *** [/opt/src/redsocks/android/obj/local/armeabi/objs/redsocks/socks5-udp.o] Error 1
    wohenyingyu01
        6
    wohenyingyu01  
       2016-08-20 13:17:56 +08:00 via iPhone
    没有 include <netinet/in.h>头文件
    xseven007
        7
    xseven007  
    OP
       2016-08-20 16:59:39 +08:00
    @wohenyingyu01 已经 include 了的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4742 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 09:33 · PVG 17:33 · LAX 01:33 · JFK 04:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.