1、Linux本机下的编译
(1)、下载安装包zebra-0.95a.tar
(2)、解压到当前的目录下:tar zxf zebra-0.95a.tar
(3)、./configure
[root@localhost zebra-0.95a]# ./configure checking for a BSD-compatible install... /usr/bin/install -c ........................................ zebra configuration ------------------- zebra version : 0.95a host operationg system : linux-gnu source code location : . compiler : gcc compiler flags : -g -O2 -Wall link libraries : -lm -lcrypt directory for pid files : /var/run
[root@localhost zebra-0.95a]#
|
(4)、make
|
(5)、make install
[root@localhost zebra-0.95a]# cd /usr/local/sbin/ [root@localhost sbin]# ls bgpd ospf6d ospfd ripd ripngd zebra [root@localhost sbin]# |
(6)、cd /usr/local/etc
[root@localhost etc]# cd /usr/local/etc/ [root@localhost etc]# ls bgpd.conf.sample bgpd.conf.sample2 ospf6d.conf.sample ospfd.conf.sample ripd.conf.sample ripngd.conf.sample zebra.conf zebra.conf.sample [root@localhost etc]# |
(7)、cp zebra.conf.sample zebra.conf
完成安装
2、在P2020的环境下编译
(1)、查看编译环境
[root@localhost zebra-0.95a]# powerpc-none-linux-gnuspe-gcc -v Using built-in specs. Target: powerpc-none-linux-gnuspe Configured with: ../gcc-4.3.2/configure --target=powerpc-none-linux-gnuspe --host=i686-pc-linux-gnu --prefix=/opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe --with-sysroot=/opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/powerpc-none-linux-gnuspe/libc --disable-libssp --disable-libmudflap --disable-libstdcxx-pch --enable-libgomp --enable-shared --enable-threads --enable-languages=c,c++ --with-gmp=/usr/src/redhat/BUILD/csl-tc-4.3.74/host-libs/usr --with-mpfr=/usr/src/redhat/BUILD/csl-tc-4.3.74/host-libs/usr --with-cpu=8548 --with-gnu-as --with-gnu-ld --enable-symvers=gnu --enable-__cxa_atexit --enable-cxx-flags=-mcpu=8548 --disable-multilib --with-long-double-128 --disable-nls --enable-e500_double Thread model: posix gcc version 4.3.2 (GCC) [root@localhost zebra-0.95a]# |
(2)、带编译环境进行编译
./configure --host=powerpc-none-linux-gnuspe --prefix=/opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe |
(3)、make install安装
[root@localhost sbin]# pwd /opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/sbin [root@localhost sbin]# ls bgpd ospf6d ospfd ripd ripngd zebra [root@localhost sbin]#
[root@localhost etc]# pwd /opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/etc [root@localhost etc]# ls bgpd.conf.sample bgpd.conf.sample2 ospf6d.conf.sample ospfd.conf.sample ripd.conf.sample ripngd.conf.sample zebra.conf.sample [root@localhost etc]# |
安装完成
3、遇到问题
(1)、问题: dereferencing pointer to incomplete type
描述: rtadv.c:123: error: dereferencing pointer to incomplete type rtadv.c:124: error: dereferencing pointer to incomplete type rtadv.c:124: error: dereferencing pointer to incomplete type 解决: 打开zebra-0.95a/lib/zebra.h文件, 定位到103行,添加如下内容,即可解决。
#ifdef GNU_LINUX #define __USE_GNU #endif |
(2)、Relocations in generic ELF (EM: 3)
描述: Relocations in generic ELF (EM: 3) 解决:make clean -w ,然后make |