天天看點

zebra 編譯



1、Linux本機下的編譯

(1)、下載下傳安裝包zebra-0.95a.tar

(2)、解壓到目前的目錄下:tar zxf zebra-0.95a.tar

(3)、./configure 

[[email protected] 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

[[email protected] zebra-0.95a]# 

(4)、make 

(5)、make install

[[email protected] zebra-0.95a]# cd /usr/local/sbin/

[[email protected] sbin]# ls

bgpd  ospf6d  ospfd  ripd  ripngd  zebra

[[email protected] sbin]# 

(6)、cd /usr/local/etc

[[email protected] etc]# cd /usr/local/etc/

[[email protected] 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

[[email protected] etc]# 

(7)、cp zebra.conf.sample zebra.conf

完成安裝

2、在P2020的環境下編譯

(1)、檢視編譯環境

[[email protected] 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) 

[[email protected] 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安裝

[[email protected] sbin]# pwd

/opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/sbin

[[email protected] sbin]# ls

bgpd  ospf6d  ospfd  ripd  ripngd  zebra

[[email protected] sbin]# 

[[email protected] etc]# pwd

/opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/etc

[[email protected] etc]# ls

bgpd.conf.sample  bgpd.conf.sample2  ospf6d.conf.sample  ospfd.conf.sample  ripd.conf.sample  ripngd.conf.sample  zebra.conf.sample

[[email protected] 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

繼續閱讀