[avahi] Problems compiling avahi for Android NDK project

Chris Perry slushduck at hotmail.com
Mon Oct 22 18:58:50 PDT 2012


Hi again,

Starting fresh

1) Git avahi
git clone git://git.0pointer.de/avahi.git

2) Download the Android patches:
From: http://avahi.org/ticket/354
Apply the two patches:
git am < 0001-Add-Android-support.patch 
git am < 0002-Add-uninstalled.pc.in-files.patch 

3) Remove the patch from avahi-core/socket.c:
Commented out the following lines:
#ifdef __BIONIC__
struct in6_pktinfo {
	struct in6_addr ipi6_addr;
	int ipi6_ifindex;
};
#endif

4) building the lib:
-Make sure androgenizer is built and in my path
which androgenizer
/usr/local/bin/androgenizer

-Starting with the Android.mk file provided by the patch
-Added AVAHI_TOP variable definition and commands for building the shared lib.
-<Android.mk file attached>

ndk-build or ndk-build V=1 NDK_LOG=2 APP_ABI="armeabi armeabi-v7a"
results in the same thing:

jni/Android.mk:20: warning: overriding commands for target `avahi-configure-real'
jni/Android.mk:20: warning: ignoring old commands for target `avahi-configure-real'
Install        : libavahi.so => libs/armeabi/libavahi.so
Install        : libavahi.so => libs/armeabi-v7a/libavahi.so

This lib is 38K and when I link my project against it all the avahi commands are unresolved references
undefined reference to `avahi_server_add_service'
undefined reference to `avahi_server_add_service'
undefined reference to `avahi_server_add_service_subtype'
undefined reference to `avahi_s_entry_group_commit'
etc...



There are no Android.mk files present in any of the Avahi subdirectories (like avahi-core etc)
So I don't think it's running androgenizer.
It doesn't seem like any sources are being compiled into the lib, 38K seems small.

Not sure how to proceed here, problem with the Android.mk file most likely?

Thanks,
Chris






On Oct 20, 2012, at 5:20 PM, Chris Perry wrote:

> 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
> 
> _______________________________________________
> 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/20121022/5c5355f9/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Android.mk
Type: application/octet-stream
Size: 1981 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/avahi/attachments/20121022/5c5355f9/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/avahi/attachments/20121022/5c5355f9/attachment-0003.html>


More information about the avahi mailing list