一 Quagga 编译的依赖包
- libcares
- libncurses
- libreadline
其中libreadline是需要libncurses支持的,如果没有ncurses,在编译quagga时会出现如下错误**/libreadline.so: undefined reference to `PC' **/libreadline.so: undefined reference to `tgetflag' **/libreadline.so: undefined reference to `tgetent' **/libreadline.so: undefined reference to `UP' **/libreadline.so: undefined reference to `tputs' **/libreadline.so: undefined reference to `tgoto' **/libreadline.so: undefined reference to `tgetnum' **/libreadline.so: undefined reference to `BC' **/libreadline.so: undefined reference to `tgetstr'
二 先交叉编译三个依赖包
- libcares
anzye@anzye:c-ares-1.15.0$ ./configure --host=arm-linux --prefix=/opt/arm_lib anzye@anzye:c-ares-1.15.0$ make && make install
- libncurses
anzye@anzye:ncurses-6.1$ ./configure --host=arm-linux --prefix=/opt/arm_lib --with-shared anzye@anzye:ncurses-6.1$ make && make install
- libreadline
说明:如果是readline-6.3版 ,配置时要加上bash_cv_wcwidth_broken=yes
一项,或注释掉configure中的对应报错项,否则报错。如下
oranzye@anzye:readline-6.3$ ./configure --host=arm-linux --prefix=/opt/arm_lib *** *** checking for wcwidth broken with unicode combining characters... configure: error: in `/.../readline-6.3': configure: error: cannot run test program while cross compiling anzye@anzye:readline-6.3$ ./configure --host=arm-linux --prefix=/opt/arm_lib bash_cv_wcwidth_broken=yes anzye@anzye:readline-6.3$ make && make install
anzye@anzye:readline-7.0$ ./configure --host=arm-linux --prefix=/opt/arm_lib anzye@anzye:readline-7.0$ make && make install
三 编译Quagga
anzye@anzye:quagga-1.2.4$./configure \
--prefix=`pwd`/install \
--host=arm-linux \
--disable-doc \
--enable-static=no \
--enable-user=root \
--enable-group=root \
--enable-vty-group=root \
CFLAGS=-L/opt/arm_lib/lib \
CPPFLAGS=-I/opt/arm_lib/include
anzye@anzye:c-ares-1.15.0$ make && make install
不指明“CFLAGS=-L/opt/arm_lib/lib\ CPPFLAGS=-I/opt/arm_lib/include”会报找不到头文件或库,因为上面编译安装的都在“/opt/arm_lib/”目录下