I am a newbie in cross compilation and I was assigned the task to use the android patch http://avahi.org/ticket/354 to compile avahi core to android. ndk-build avahi-configure V=1 was successful, but when I ran: ndk-build V=1 NDK_LOG=2 APP_ABI="armeabi armeabi-v7a", it gives tons of warning and also make error on socket.o
Any suggestion is welcomed.
Error: /home/ruoruo/Software/android- ndk-r8b/platforms/android-14/arch-arm/usr/include/linux/if.h:85:12: warning: comma at end of enumerator list [-pedantic] /home/ruoruo/Software/android-ndk-r8b/platforms/android-14/arch-arm/usr/include/linux/if.h:90:22: warning: comma at end of enumerator list [-pedantic] /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni/avahi-core/socket.c:68:8: error: redefinition of 'struct in6_pktinfo' /home/ruoruo/Software/android-ndk-r8b/platforms/android-14/arch-arm/usr/include/linux /ipv6.h:21:8: note: originally defined here /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni/avahi-core/socket.c: In function 'avahi_mdns_mcast_join_ipv6': /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni/avahi-core/socket.c:150:64: warning: unused parameter 'a' [-Wunused-parameter] /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni/avahi-core/socket.c: In function 'avahi_recv_dns_packet_ipv4': /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni/avahi-core/socket.c:647:9: warning: variable 'found_addr' set but not used [-Wunused-but-set-variable] /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni/avahi-core/socket.c: In function 'avahi_recv_dns_packet_ipv6': /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni/avahi-core/socket.c:809:24: warning: variable 'found_iface' set but not used [-Wunused-but-set-variable] /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni/avahi-core/socket.c:809:9: warning: variable 'found_ttl' set but not used [-Wunused-but-set-variable] make: * [/home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/obj/local/armeabi/objs/avahi-core/socket.o] Error 1
Here is my Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
AVAHI_TOP := /home/ruoruo/Software/android-ndk-r8b/samples/avahi_exports/jni
CONFIGURE := configure
CONFIGURE_LDFLAGS := -lc -ldl
AVAHI_BUILT_SOURCES := \
avahi-common/Android.mk \
avahi-core/Android.mk \
avahi-client-uninstalled.pc \
avahi-client/Android.mk \
avahi-utils/Android.mk \
avahi-glib/Android.mk \
avahi-glib-uninstalled.pc \
avahi-gobject/Android.mk \
avahi-gobject-uninstalled.pc \
avahi-daemon/Android.mk
avahi-configure-real:
cd $(AVAHI_TOP) ; \
# CC="$(CONFIGURE_CC)" \
# CFLAGS="$(CONFIGURE_CFLAGS)" \
# LD=$(TARGET_LD) \
LDFLAGS="$(CONFIGURE_LDFLAGS)" \
# CPP=$(CONFIGURE_CPP) \
# CPPFLAGS="$(CONFIGURE_CPPFLAGS)" \
# PKG_CONFIG_LIBDIR=$(CONFIGURE_PKG_CONFIG_LIBDIR) \17
# PKG_CONFIG_TOP_BUILD_DIR=$(PKG_CONFIG_TOP_BUILD_DIR) \
$(AVAHI_TOP)/$(CONFIGURE) --host=arm-linux-androideabi \
--disable-nls --disable-gtk --disable-gtk3 \
--disable-dbus --disable-python \
--disable-xmltoman --with-xml=none \
--disable-glib --disable-gobject --disable-qt3 --disable-qt4 \
--disable-gdbm --disable-libdaemon \
--with-distro=none --disable-core-docs \
--disable-Werror
echo "before make file"
for file in $(AVAHI_BUILT_SOURCES); do \
rm -f $$file && \
make -C $$(dirname $$file) $$(basename $$file) ; \
done
avahi-configure: avahi-configure-real
.PHONY: avahi-configure
CONFIGURE_TARGETS += avahi-configure
#include all the subdirs...
#-include $(AVAHI_TOP)/avahi-common/Android.mk
#-include $(AVAHI_TOP)/avahi-client/Android.mk
-include $(AVAHI_TOP)/avahi-core/Android.mk
#-include $(AVAHI_TOP)/avahi-daemon/Android.mk
#-include $(AVAHI_TOP)/avahi-glib/Android.mk
#-include $(AVAHI_TOP)/avahi-gobject/Android.mk
#-include $(AVAHI_TOP)/avahi-utils/Android.mk
#generate libavahi.so and libavahi.a
LOCAL_MODULE := avahi_static
LOCAL_MODULE_FILENAME := libavahi
-include $(BUILD_STATIC_LIBRARY)
LOCAL_MODULE := avahi_shared
LOCAL_MODULE_FILENAME := libavahi
-include $(BUILD_SHARED_LIBRARY)
Create
Application.mk
with the following content:Then omit
APP_ABI="armeabi armeabi-v7a"
in yourndk-build
command.The patch you have downloaded is not up-to-date. The latest NDK, r8b, contains the file
linux/ipv6.h
which could not be found on the earlier versions of NDK. Unfortunately this change to NDK, welcome as it is, has never been documented.This means that you must undo the patch to
socket.c
file, by removing the linesfrom
avahi-core/socket.c
file.