(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
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

编译 OpenSceneGraph (OSG) for Android 需要使用交叉编译工具链(cross-compilation toolchain),可以使用 Android NDK 中提供的工具链来完成。以下是编译 OSG 的大致步骤: 1. 下载并安装 Android NDK,可以从官网下载。 2. 下载 OSG 的源代码,可以从官网下载。 3. 解压 OSG 源代码,进入源代码目录。 4. 设置环境变量,使得编译器可以找到 Android NDK 中的工具链,例如: ``` export ANDROID_NDK=$HOME/android-ndk-r10e export PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH export CC=arm-linux-androideabi-gcc export CXX=arm-linux-androideabi-g++ ``` 其中 `$HOME/android-ndk-r10e` 是 Android NDK 的安装路径。 5. 运行 cmake 命令生成 Makefile: ``` mkdir build_android cd build_android cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ -DANDROID_ABI=&quot;armeabi-v7a&quot; \ -DANDROID_NATIVE_API_LEVEL=android-14 \ -DCMAKE_INSTALL_PREFIX=/path/to/install/directory \ .. ``` 其中 `-DANDROID_ABI=&quot;armeabi-v7a&quot;` 表示编译为 armeabi-v7a 架构,`-DANDROID_NATIVE_API_LEVEL=android-14` 表示使用 Android 14 的 API 级别。`-DCMAKE_INSTALL_PREFIX` 表示安装路径。 6. 运行 make 命令编译 OSG: ``` make -j4 ``` 其中 `-j4` 表示使用 4 个线程进行编译。 7. 运行 make install 命令安装 OSG: ``` make install ``` 至此,OSG 的编译就完成了。 如果需要编译 osgEarth,可以按照类似的步骤,先编译 OSG,再编译 osgEarth。在 cmake 命令中需要添加 `-DOSG_DIR=/path/to/osg/install/directory` 参数,指定 OSG 的安装路径。例如: ``` cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ -DANDROID_ABI=&quot;armeabi-v7a&quot; \ -DANDROID_NATIVE_API_LEVEL=android-14 \ -DCMAKE_INSTALL_PREFIX=/path/to/install/directory \ -DOSG_DIR=/path/to/osg/install/directory \ .. ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值