我有来自here的nanomsg和Android.mk。 我尝试使用Android NDK为Android构建它。 我有错误:
[armeabi] Compile thumb : nano <= usock.c
In file included from /home/roman/work/Nano/app/jni/src/aio/usock.c:28:0:
/home/roman/work/Nano/app/jni/src/aio/usock_posix.inc: In function 'nn_usock_recv_raw':
/home/roman/work/Nano/app/jni/src/aio/usock_posix.inc:1112:8: error: 'struct msghdr' has no member named 'msg_accrights'
hdr.msg_accrights = ctrl;
^
/home/roman/work/Nano/app/jni/src/aio/usock_posix.inc:1113:8: error: 'struct msghdr' has no member named 'msg_accrightslen'
hdr.msg_accrightslen = sizeof (int);
^
In file included from /home/roman/work/Nano/app/jni/src/aio/usock.c:28:0:
/home/roman/work/Nano/app/jni/src/aio/usock_posix.inc:1151:16: error: 'struct msghdr' has no member named 'msg_accrightslen'
if (hdr.msg_accrightslen > 0) {
^
/home/roman/work/Nano/app/jni/src/aio/usock_posix.inc:1152:46: error: 'struct msghdr' has no member named 'msg_accrightslen'
nn_assert (hdr.msg_accrightslen == sizeof (int));
^
In file included from /home/roman/work/Nano/app/jni/src/aio/usock.c:28:0:
/home/roman/work/Nano/app/jni/src/aio/usock_posix.inc:1154:45: error: 'struct msghdr' has no member named 'msg_accrights'
*self->in.pfd = *((int*) hdr.msg_accrights);
^
/home/roman/work/Nano/app/jni/src/aio/usock_posix.inc:1158:41: error: 'struct msghdr' has no member named 'msg_accrights'
nn_closefd (*((int*) hdr.msg_accrights));
^
make: *** [/home/roman/work/Nano/app/obj/local/armeabi/objs/nano/src/aio/usock.o] Error 1
有什么问题? 我希望任何人都可以提供帮助。
答案 0 :(得分:1)
在Android.mk文件上替换
带有这些行的LOCAL_CFLAGS
LOCAL_CFLAGS := \
-DNN_HAVE_STDINT \
-DNN_HAVE_CLOCK_MONOTONIC \
-DNN_HAVE_PIPE \
-DNN_HAVE_SOCKETPAIR \
-DNN_HAVE_SEMAPHORE \
-DNN_HAVE_POLL \
-DNN_USE_POLL \
-DNN_USE_LITERAL_IFADDR \
-DNN_HAVE_MSG_CONTROL
这两行也是。
LOCAL_COPY_HEADERS_TO := nanomsg
LOCAL_COPY_HEADERS := nn.h bus.h reqrep.h pipeline.h pair.h survey.h pubsub.h
如需更多参考,请查看以下链接:
https://gist.github.com/kroggen/ff49ad06e78754068be6/revisions