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

2016-08-19 21:50:13 +08:00
 xseven007

有用 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 友有什么解决方法么?
10059 次点击
所在节点    Android
7 条回复
rphoho
2016-08-19 23:05:49 +08:00
proxydroid 里的有,编得过。
allenforrest
2016-08-19 23:11:24 +08:00
想省事:
#define IPPROTO_TCP 6 /* tcp */
xseven007
2016-08-20 11:45:48 +08:00
@rphoho proxydroid 里面的应该是 redsocks 原版吧?
xseven007
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
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
2016-08-20 13:17:56 +08:00
没有 include <netinet/in.h>头文件
xseven007
2016-08-20 16:59:39 +08:00
@wohenyingyu01 已经 include 了的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/300527

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX