(OK)(OK) cross compile quagga-0.99.21mr2.2 for android-x86 in Fedora23
------------------------------------------------
cross compile quagga-0.99.21mr2.2 for android-x86 in Fedora23
quagga-0.99.21mr2.2 can be got from http://downloads.pf.itd.nrl.navy.mil/ospf-manet/
------------------------------------------------
[root@localhost quagga]# pwd
/opt/android-on-linux/quagga
[root@localhost quagga]# make clean
[root@localhost quagga]# ./bootstrap.sh
++++++++++++++++++ Issues
[root@localhost quagga]# gedit lib/zebra.h
//#include <sys/fcntl.h>
#include <fcntl.h>
++++++++++++++++++
xorp/libxorp/ipv4.hh:471:48: error: macro "static_assert" requires 2 arguments, but only 1 given
xorp/libxorp/ipv6.hh:425:52: error: macro "static_assert" requires 2 arguments, but only 1 given
[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/ipv4.hh
//static_assert(sizeof(IPv4) == sizeof(uint32_t));
static_assert(sizeof(IPv4) == sizeof(uint32_t), "");
[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/ipv6.hh
//static_assert(sizeof(IPv6) == 4 * sizeof(uint32_t));
static_assert(sizeof(IPv6) == 4 * sizeof(uint32_t), "");
[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/ipvx.cc ./xpimd/xorp/libxorp/selector.cc ./xpimd/xorp/libproto/packet.hh
//static_assert(*);
[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/utility.h
//#define UNUSED(var) static_assert(sizeof(var) != 0)
#define UNUSED(var) static_assert(sizeof(var) != 0, "")
[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/ipv6.cc
//static_assert(sizeof(_addr) == sizeof(tmp_addr));
static_assert(sizeof(_addr) == sizeof(tmp_addr), "");
--------------
/opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/__config:598:0: note: this is the location of the previous definition
#define static_assert(__b, __m) \
--------------
++++++++++++++++++
xorp/fea/mfea_proto_comm.cc:1657:46: error: invalid conversion from 'void*' to 'const uint8_t* {aka const unsigned char*}' [-fpermissive]
int_val = extract_host_int(CMSG_DATA(cmsgp));
-----
/opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/include/sys/socket.h:112:0: note: this is the location of the previous definition
#define CMSG_DATA(cmsg) ((void*)((char*)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
[root@localhost quagga]# gedit ./xpimd/xorp/fea/mfea_proto_comm.cc
// add the following lines
#define CMSG_DATA(cmsg) ((uint8_t*)((char*)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
#ifndef CMSG_LEN
#else // ! HAVE_RFC3542
#undef HAVE_IPV6_MULTICAST_ROUTING
++++++++++++++++++++++
xorp/pim/pim_mrt_task.cc:185:14: error: ambiguous overload for 'operator!=' (operand types are 'std::__ndk1::list<PimMreTask*>::reverse_iterator {aka std::__ndk1::reverse_iterator<std::__ndk1::__list_iterator<PimMreTask*, void*> >}' and 'std::__ndk1::list<PimMreTask*>::reverse_iterator {aka std::__ndk1::reverse_iterator<std::__ndk1::__list_iterator<PimMreTask*, void*> >}')
if (iter != pim_mre_task_list().rend()) {
^
xorp/pim/pim_mrt_task.cc:185:14: note: candidates are:
In file included from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/memory:604:0,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:628,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/string:439,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:15,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/ios:216,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/iostream:38,
from xorp/libxorp/xorp.h:35,
from xorp/pim/pim_mrt_task.cc:23:
/opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/iterator:593:1: note: bool std::__ndk1::operator!=(const std::__ndk1::reverse_iterator<_Iter1>&, const std::__ndk1::reverse_iterator<_Iter2>&) [with _Iter1 = std::__ndk1::__list_iterator<PimMreTask*, void*>; _Iter2 = std::__ndk1::__list_iterator<PimMreTask*, void*>]
operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
In file included from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:627:0,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/string:439,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:15,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/ios:216,
from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/iostream:38,
from xorp/libxorp/xorp.h:35,
from xorp/pim/pim_mrt_task.cc:23:
/opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/utility:172:1: note: bool std::__ndk1::rel_ops::operator!=(const _Tp&, const _Tp&) [with _Tp = std::__ndk1::reverse_iterator<std::__ndk1::__list_iterator<PimMreTask*, void*> >]
operator!=(const _Tp& __x, const _Tp& __y)
^
------------
[root@localhost quagga]# gedit ./xpimd/xorp/pim/pim_mrt_task.cc (four places)
//if (iter != pim_mre_task_list().rend()) {
if (!(iter == pim_mre_task_list().rend())) {
++++++++++++++++++++++
[root@localhost quagga]# gedit ./xpimd/xorp/pim/pim_vif.cc
#include <netinet/ip6.h>
#include <netinet/in.h>
++++++++++++++++++++++
zebra_client.cc:186: error: undefined reference to 'zcalloc(int, unsigned int)'
zebra_client.cc:242: error: undefined reference to 'zfree(int, void*)'
[root@localhost quagga]# gedit xpimd/zebra_client.cc
#if 1 /* set to 1 to use system alloc directly */
#undef XMALLOC
#undef XCALLOC
#undef XREALLOC
#undef XFREE
#define XMALLOC(T,S) malloc((S))
#define XCALLOC(T,S) calloc(1, (S))
#define XREALLOC(T,P,S) realloc((P),(S))
#define XFREE(T,P) free((P))
#endif
++++++++++++++++++++++
zebra_router.cc:48: error: undefined reference to 'memory_init()'
[root@localhost quagga]# gedit xpimd/zebra_router.cc
vty_init(master);
//memory_init();
++++++++++++++++++++++
++++++++++++++++++++++
++++++++++++++++++++++
++++++++++++++++++
../lib/.libs/libzebra.so: error: undefined reference to 'crypt'
download from (libcrypt.so.1) https://sourceforge.net/p/android-x86/bootable_newinstaller/ci/9a49bb368ac83fa339678d259ec2c6c668267db8/tree/initrd/lib/libcrypt.so.1?format=raw
cp libcrypt.so.1 /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so
cp libcrypt.so.1 /opt/android-on-linux/android-ndk-r10e/platforms/android-21/arch-x86/usr/lib/libcrypt.so
++++++++++++++++++
[root@localhost quagga]#
./bootstrap.sh
-------------------------------------------------------
android-ndk-r12 + android-23 + x86-4.9 (use)
-------------------------------------------------------
make clean
export NDK_ROOT="/opt/android-on-linux/android-ndk-r12"
export SYSROOT="$NDK_ROOT/platforms/android-23/arch-x86"
export CFLAGS="-g --pipe --sysroot=$SYSROOT -I$NDK_ROOT/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/include-fixed/ -I$NDK_ROOT/platforms/android-23/arch-x86/usr/include -I$NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include/ -I$NDK_ROOT/sources/android/support/include/"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_static -lsupc++ -lc++ -lgcc -lc"
export CPATH="/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin"
export CPP="$CPATH/i686-linux-android-cpp"
export CXX="$CPATH/i686-linux-android-g++"
export CC="$CPATH/i686-linux-android-gcc"
export LD="$CPATH/i686-linux-android-ld"
export AR="$CPATH/i686-linux-android-ar"
echo "ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}" > arm-linux.cache
echo "ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}" >> arm-linux.cache
echo "ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}" >> arm-linux.cache
./configure --enable-user=root --enable-group=root --host=i686-android-linux --enable-vtysh=no --cache-file=arm-linux.cache --exec-prefix=/opt/android-on-linux/quagga/out --prefix=/opt/android-on-linux/quagga/out
make -j4
-------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, cross compile successfully quagga-0.99.21mr2.2 for android-x86 in Fedora23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++