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

导读:
  交叉编译场景分析(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"
  
  Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=646988

本文转自
http://blog.csdn.net/absurd/archive/2006/04/01/646988.aspx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值