您的位置:首页 > 运维架构 > Linux

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

2007-06-22 14:41 639 查看
交叉编译场景分析(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
前置条件
<
4000
div>源文件位置:$(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"
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息