交叉编译场景分析(arm-linux)(七)--编译sqlite

王朝system·作者佚名  2007-01-23
宽屏版  字体: |||超大  

交叉编译场景分析(arm-linux)(七)--编译sqlite

转载时请注明出处:http://blog.csdn.net/absurd

1. 基本信息:

软件名称

sqlite

功能简述

sqlite是一个针对嵌入式系统设计的数据库管理系统(DBMS),实现了SQL92的基本功能,ARM版的可执行文件约300K.

下载地址

http://www.sqlite.org/

软件版本

sqlite-3.3.4.tar.gz

依赖关系

默认

readline

前置条件

源文件位置:$(WORK_DIR)/ sqlite-3.3.4

2. 过程分析

下载的稳定版本,configure已经存在,直接进行配置:

[root@linux sqlite-3.3.4]# ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr

出现了如下错误:

configure: error: unable to find a compiler for building build tools

前面检查arm-linux-gcc都通过了,怎么还说没有找到编译器呢?花了点时间看configure的脚本,太复杂了,又结合configure.ac看了一下。原来是要设置config_TARGET_CC和config_BUILD_CC两个环境变量。config_TARGET_CC是交叉编译器,config_BUILD_CC是主机编译器。重来:

[root@linux sqlite-3.3.4]# export config_BUILD_CC=gcc

[root@linux sqlite-3.3.4]# export config_TARGET_CC=arm-linux-gcc

[root@linux sqlite-3.3.4]# ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr

出现了如下错误:

checking for /usr/include/readline.h... configure: error: cannot check for file existence when cross compiling

readline我们已经编译过了,readline.h是肯定存在,没有必要检查。还是施展我们欺骗大法吧,在cache文件里设置ac_cv_header_readline_h=yes,骗过configure脚本:

[root@linux sqlite-3.3.4]# echo ac_cv_header_readline_h=yes >$ARCH-linux.cache

[root@linux sqlite-3.3.4]#./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --cache-file=$ARCH-linux.cache

这回配置成功了,编译:

[root@linux sqlite-3.3.4]# make && make install

有的机器上会出现下列错误:

libtool: compile: unable to infer tagged configuration

libtool: compile: specify a tag with `--tag'

这时检查一下libtool里的CC变量是否设置为arm-linux-gcc,如果不是,可以手工改过来,或者设置环境变量lt_compiler=arm-linux-gcc,重新配置一下。

OK,经过几番周折,终于编译过去了。

3. 构建处方

l sqlite.mk

SQLITE_DIR="sqlite-3.3.4"

all: clean config build

config:

@cd $(SQLITE_DIR) && export config_BUILD_CC=gcc && export config_TARGET_CC=arm-linux-gcc && echo ac_cv_header_readline_h=yes >$$ARCH-linux.cache && ./configure --host=$$ARCH-linux --prefix=$$ROOTFS_DIR/usr --cache-file=$$ARCH-linux.cache && echo "config done"

build:

@cd $(SQLITE_DIR) && make && make install && echo "build done"

clean:

@cd $(SQLITE_DIR) && if [ -e Makefile ]; then make distclean; fi && echo "clean done"

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有