开发平台:Ubuntu11.04
编 译器:arm-gcc-4.1.1.tar.bz2 (可从http://download.csdn.net/detail/npy_lp/3821111上下载)
Popt源码包:popt-1.7.tar.gz (可从http://download.csdn.net/detail/npy_lp/3830473上下载)
此库被一些程序用于解析命令行选项。
交叉编译popt-1.7.tar.gz:
$ tar zvxf popt-1.7.tar.gz
$ cd popt-1.7/
$ ./configure CC=arm-linux-gnu-gcc --host=arm-linux --prefix=$PWD/_install
如果在配置过程中出现“Checkingfor GNU xgettext… configure: error:”这样的错误提示,请安装gettext后,继续执行configure命令进行配置,然后编译和安装。
$ sudo apt-get install gettext
$ ./configure CC=arm-linux-gnu-gcc --host=arm-linux --prefix=$PWD/_install
$ make && make install
交叉编译最新版本的popt库popt-1.14.tar.gz(可从http://freecode.com/projects/popt上下载):
$ tar zvxf popt-1.14.tar.gz
$ cd popt-1.14/
$ ./configure CC=arm-linux-gnu-gcc --prefix=$PWD/_install --host=arm-linux
配置过程中会出现以下错误:
checking for va_copy() function... configure: error: cannot run test program while cross compiling
根据错误信息在configure文中查找错误发生处:
{ echo "$as_me:$LINENO: checking for va_copy() function" >&5
echo $ECHO_N "checking for va_copy() function... $ECHO_C" >&6; }
if test "${ac_cv_va_copy+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
从中可知变量ac_cv_va_copy无法被自动配置上,所以:
$ echo ac_cv_va_copy=yes > arm-linux.cache
$ ./configure CC=arm-linux-gnu-gcc --prefix=$PWD/_install --host=arm-linux --cache-file=arm-linux.cache
$ make && make install
以后碰到类似的错误也可以按照这样的方法处理。