[avahi] Problems compiling avahi for Android NDK project

Chris Perry slushduck at hotmail.com
Sat Oct 20 17:20:55 PDT 2012


Ahhh, ok I understand thanks!

After reading your stackoverflow post we assumed that the patch was not necessary at all.
Bad assumption!  I'll give that a go and will report back here.

Thanks again Lily!


On Oct 20, 2012, at 4:36 PM, Ruoruo Zhang(Lily) wrote:

> You need still need the patch for other reasons, like the one you hit in avahi-core. Apply the patch, but make sure you remove the patch for socket.c. I am quite sure it works for avahi.0.6.31.
> 
> Lily Zhang
> 
> 
> On Sat, Oct 20, 2012 at 3:43 PM, Chris Perry <slushduck at hotmail.com> wrote:
> Thanks Lilly, I did see your stackoverflow post (referenced below) which prompted us to update to android-ndk-r8b.
> I'm actually curious as to how you made all those Android.mk files -like I mentioned below, I couldn't figure out Androgenizer.
> 
> Anyway, the error you posted was:
> error: redefinition of 'struct in6_pktinfo'
> 
> When we try to make avahi from command line we get
>>> socket.c:609: error: 'IPV6_PKTINFO' undeclared
> 
> When we try to build avahi from Android.mk we get:
>>> /avahi-0.6.31/avahi-core/iface-linux.h:27:8: Redefinition of 'struct AvahiInterfaceMonitorOSDep'
> 
> 
> Is that related to the patch as well?
> 
> I don't think we have the patch for socket.c but would like to confirm that somehow.
> -I've searched socket.c for #ifdef __BIONIC__ and it is not there, so I assumed that our copy of avahi-0.6.31 is un-patched.
> -Is that a correct assumption?
> 
> Not sure of the policies with this mailing list, I could attach socket.c if that would help someone confirm it is not patched.
> 
> Thanks again,
> Chris
> 
> 
> On Oct 20, 2012, at 1:38 PM, Ruoruo Zhang wrote:
> 
>> You need to remove the patch for socket.c. New ndk has ipv6 support already. 
>> 
>> I had a stackoverflow question posted and answered regarding his issue. 
>> 
>> From Ruoruo (Lily) Zhang
>> 
>> On Oct 20, 2012, at 1:34 PM, Chris Perry <slushduck at hotmail.com> wrote:
>> 
>>> Hi there,
>>> 
>>> 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.
>>> 
>>> 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.
>>> 
>>> I'm hoping that someone here can help me get avahi compiling.
>>> 
>>> Project uses android-ndk-r8b and is being built on OSX 10.7.4 using command line (not eclipse)
>>> 
>>> Got the latest Avahi source from here:
>>> http://www.linuxfromscratch.org/blfs/view/svn/basicnet/avahi.html
>>> 
>>> 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.
>>> 
>>> make results in this compile error
>>> 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
>>> 
>>> Figured that it's not building against the android-ndk-r8b libs or finding ipv6.h or something.
>>> 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
>>> 
>>> 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
>>> 
>>> 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.
>>> 
>>> Found this post on creating an appropriate Android.mk file
>>> http://stackoverflow.com/questions/12618829/cant-compile-avahi-on-android
>>> 
>>> Realized that I don't have Android.mk files within all the subdirectories.
>>> 
>>> 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 =/
>>> 
>>> 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)
>>> 
>>> 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':
>>> 
>>> 
>>> And now I'm pretty much stuck.  
>>> 
>>> 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.
>>> Thinking that it may be something I've done wrong with the ./configure command?
>>> 
>>> I figure this must be something that quite a few developers are dealing with so I must be missing something because I can't seem to find any good information via google.
>>> 
>>> Any help would be much appreciated!
>>> 
>>> Thanks,
>>> Chris
>>> _______________________________________________
>>> avahi mailing list
>>> avahi at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/avahi
>> _______________________________________________
>> avahi mailing list
>> avahi at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/avahi
> 
> 
> _______________________________________________
> avahi mailing list
> avahi at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/avahi
> 
> 
> _______________________________________________
> avahi mailing list
> avahi at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/avahi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/avahi/attachments/20121020/39a04806/attachment-0001.html>


More information about the avahi mailing list