编译问题的avahi到的Andr​​oid NDK项目项目、问题、avahi、Andr

2023-09-06 19:04:32 作者:δ女人不过是解闷的花生米

在过去的几天里,我一直在有困难的时候试图建立的avahi为静态或共享库与现有的Andr​​oid NDK项目中使用。

Over the last few days I've been having a difficult time trying to build avahi into a static or shared library for use with an existing Android NDK project.

我们有几场比赛中的应用和游戏商店,我的任务是让多人在Android版本的工作。 具体任务包括更换卓悦组件,以便这些游戏可以通过零配置相互连接。

We have a few games in the App and Play stores and my task is to get multiplayer working in the Android versions. Specifically the task involves replacing the Bonjour component so that these games can connect to each other via zeroconf.

研究似乎表明,Avahi这个是我们正在寻找的lib,但在这一点上,我愿意接受任何东西,将工作!

Research seemed to indicate that avahi is the lib that we're looking for, but at this point I'm open to anything that will work!

我希望这里有人可以帮我弄的avahi编译或暗示另一种更合适的(和更容易安装)库。

I'm hoping that someone here can either help me get avahi compiling or suggest another more appropriate (and easier to install) lib.

项目采用Android的NDK-R8B并正在使用命令行建立在OSX 10.7.4(不偏食)

Project uses android-ndk-r8b and is being built on OSX 10.7.4 using command line (not eclipse)

得到了最新的avahi来源从这里开始: http://www.linuxfromscratch.org/blfs/view/svn/basicnet /avahi.html

Got the latest Avahi source from here: http://www.linuxfromscratch.org/blfs/view/svn/basicnet/avahi.html

家酿所有必要的库来获得的./configure到无差错运行。

homebrewed all the necessary libs to get ./configure to run without errors.

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-static --disable-mono --disable-monodoc  --disable-gdbm --disable-libdaemon --disable-nls --disable-gtk --disable-gtk3 --disable-python --disable-qt3 --disable-qt4 --enable-core-docs --with-distro=none

./配置运行,没有明显的红旗。

./configure runs with no apparent red flags.

请结果在此编译错误:

socket.c: In function 'ipv6_pktinfo':
socket.c:271: warning: unused variable 'yes' [-Wunused-variable]
socket.c:270: warning: unused parameter 'fd' [-Wunused-parameter]
socket.c: In function 'avahi_send_dns_packet_ipv6':
socket.c:609: error: 'IPV6_PKTINFO' undeclared (first use in this function)
socket.c:609: error: (Each undeclared identifier is reported only once
socket.c:609: error: for each function it appears in.)
socket.c: In function 'avahi_recv_dns_packet_ipv6':
socket.c:869: error: 'IPV6_HOPLIMIT' undeclared (first use in this function)
socket.c:878: error: 'IPV6_PKTINFO' undeclared (first use in this function)
make[2]: *** [libavahi_core_la-socket.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

计算过,它没有建立针对Android的NDK-R8B库或找到ipv6.h什么的。

Figured that it's not building against the android-ndk-r8b libs or finding ipv6.h or something.

经过我的.bash_profile.sh文件:

Checked my .bash_profile.sh file:

export PATH=/Users/Muy01/Projects/Development/Android/android-sdks/tools/:$PATH
export PATH=/Users/Muy01/Projects/Development/Android/android-sdks/platform-tools/:$PATH
export PATH=/Users/Muy01/Projects/Development/Android/android-ndk-r8b/:$PATH

添加主机=臂的Linux androideabi到的./configure参数列表 造成此错误:

added --host=arm-linux-androideabi to the ./configure arguments list resulting in this error:

checking host system type... Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized

无法弄清楚如何获得可用的主机系统的类型,因此改变了方向的列表,并决定尝试建立通过Android.mk文件中的静态库。

Couldn't figure out how to get a list of available host system types so changed direction and decided to try and build the static lib via Android.mk file.

发现这个职位上创造一个适当的Andr​​oid.mk文件: 不能编译在Android 的avahi

Found this post on creating an appropriate Android.mk file: can't compile avahi on android

意识到,我不所有的子目录中有Android.mk文件。

Realized that I don't have Android.mk files within all the subdirectories.

的研究,下载,建,Androgenizer,试图将所有的Makefile.am文件到Android.mk文件。 http://cgit.collabora.com/git/user/derek/androgenizer。混帐/

Researched, downloaded, built, Androgenizer to try and convert all the Makefile.am files into Android.mk files. http://cgit.collabora.com/git/user/derek/androgenizer.git/

无法找出或发现如何做的信息,虽然= /

Couldn't figure out or find info on how to do that though =/

决定尝试创建自己的Andr​​oid.mk文件:

Decided to try and create my own Android.mk file:

LOCAL_PATH := $(call my-dir)
ROOT_LOCAL_PATH :=$(call my-dir)

#Build avahi into a static lib
include $(CLEAR_VARS)
AVAHI_TOP := $(ROOT_LOCAL_PATH)/../avahi-0.6.31

MY_SOURCES := $(wildcard $(AVAHI_TOP)/avahi-core/*.c*)
MY_SOURCES += $(wildcard $(AVAHI_TOP)/avahi-common/*.c*)
LOCAL_C_INCLUDES := $(AVAHI_TOP)
LOCAL_SRC_FILES := $(MY_SOURCES:$(LOCAL_PATH)%=%)

LOCAL_MODULE    := avahi

include $(BUILD_STATIC_LIBRARY)

结果在编译时错误的avahi为核心/ IFACE-linux.c:33:0:

Results in compile time errors for avahi-core/iface-linux.c:33:0:

/avahi-0.6.31/avahi-core/iface-linux.h:27:8: Redefinition of 'struct AvahiInterfaceMonitorOSDep'
/avahi-0.6.31/avahi-core/iface.h:46:16: Originally defined here
/avahi-0.6.31/avahi-core/iface-linux.h:33:9: Redeclaration of enumerator 'LIST_IFACE'
/avahi-0.6.31/avahi-core/iface.h:52:9: Previous definition of 'LIST_IFACE' was here
/avahi-0.6.31/avahi-core/iface-linux.h:34:9: Redeclaration of enumerator 'LIST_ADDR'
/avahi-0.6.31/avahi-core/iface.h:53:9: Previous definition of 'LIST_ADDR' was here
/avahi-0.6.31/avahi-core/iface-linux.h:35:9: Redeclaration of enumerator 'LIST_DONE'
/avahi-0.6.31/avahi-core/iface.h:54:9: Previous definition of 'LIST_DONE' was here
/jni//../avahi-0.6.31/avahi-core/iface-linux.c: In function 'netlink_callback':

而现在我pretty的多卡。

And now I'm pretty much stuck.

我尝试#如果0'ing出导致其他错误级联摆在IFACE-linux.c和h文件,因此概率是一个坏主意。

I tried #if 0'ing out the iface-linux.c and h files resulting in a cascading slew of other errors, so prob a bad idea.

思考,这可能是一些我用的./configure命令做错了? 也许是一个问题,我的Andr​​oid.mk文件?

Thinking that it may be something I've done wrong with the ./configure command? Perhaps an issue with my Android.mk file?

我想这一定是东西相当多的开发人员正在处理,所以我可能失去了一些东西,因为我似乎无法找到通过谷歌的任何有用信息。

I figure this must be something that quite a few developers are dealing with so I'm probably missing something because I can't seem to find any good information via google.

任何帮助将是非常美联社preciated! 我已经发送了这一点给avhi邮件列表,以及,如果我得到的回应那里,我将张贴在这里为后人。

Any help would be much appreciated! I've sent this out to the avhi mailing list as well, if I get a response there I will post here for posterity.

谢谢, 克里斯

推荐答案

我会在这里跟进为我工作的解决方案。

I'll follow up here with the solution that worked for me.

我的解决办法是使用替代的avahi JMDNS。

My solution was to use JMDNS instead of Avahi.

还有的Avahi这个邮件列表上没有太大的流量。

There's not much traffic on the Avahi mailing list.

JMDNS有工作的实例可用。 JMDNS我花了大约4个小时建立在我的NDK环境,大约一天的时间制定出一些缺陷。

JMDNS has working examples available. JMDNS took me about 4 hours to set up within my NDK environment and about a day to work out some "kinks."

 
精彩推荐
图片推荐