热门关键字:  ubuntu  分区  Fedora  linux系统进程  函数

uClinux上Berkeley DB v4.5.20移植手记

来源: 作者: 时间:2007-12-02 Tag: 点击:

Berkeley DB 是一个很棒的开源的嵌入式数据库,它主要运行在Unix/Linux上。现在它已成为Oracle的一部分,叫作Oracle Berkeley DB
下面主要介绍一下它在我最近玩的uClinux上的移植过程。

下载页面:
http://dev.sleepycat.com/downloads/releasehistorybdb.html
我使用的是当前最新版的4.5.20(点击下载)

linux:/home/work/db # ll
总用量 9078
drwxr-xr-x   2 root root       80 2006-10-08 12:36 .
drwxr-xr-x  11 root root     1120 2006-10-08 12:33 ..
-r-xr-xr-x   1 root users 9281894 2006-10-08 12:36 db-4.5.20.tar.gz

(一)解压

linux:/home/work/db # tar -zxf db-4.5.20.tar.gz
linux:/home/work/db # cd db-4.5.20/
linux:/home/work/db/db-4.5.20 # ls
.              db_checkpoint  db_upgrade     libdb_java  README
..             db_deadlock    db_verify      LICENSE     rep
btree          db_dump        dist           lock        repmgr
build_unix     db_dump185     docs           log         rpc_client
build_vxworks  db_hotbackup   env            mod_db4     rpc_server
build_windows  dbinc          examples_c     mp          sequence
clib           dbinc_auto     examples_cxx   mutex       tcl
common         db_load        examples_java  os          test
crypto         dbm            fileops        os_vxworks  txn
cxx            db_printlog    hash           os_windows  xa
db             db_recover     hmac           perl
db185          dbreg          hsearch        php_db4
db_archive     db_stat        java           qam

docs目录下有我们需要的文档,包括快速入门、各种语言的API手册等资料。
(二)配置和编译
建立一个脚本以方便配置。由于unix/linux编译时的工作路径必须是build_unix,因此我们需要在build_unix目录下创建脚本。
我创建了一个名为myconfig的脚本,内容如下:

linux:/home/work/db/db-4.5.20/build_unix # cat -n myconfig
     1  #!/bin/sh
     2
     3  CC=arm-elf-gcc
     4  CFLAGS="-Os -D__uClinux__ -fno-builtin -I/home/uClinux-dist/linux-2.4.x/include -I/home/uClinux-dist/lib/uClibc/include -I/home/uClinux-dist/lib/uClibc/include/../ "
     5  LDFLAGS="-Wl,-elf2flt -Wl,-move-rodata -L/home/uClinux-dist/lib/uClibc/lib -L/home/uClinux-dist/lib/uClibc/lib/../ -lc "
     6  ../dist/configure
     7    --prefix=/home/work/db/Berkeley.DB
     8    --build=i686-linux
     9    --host=arm-elf-linux
    10    --disable-cryptography
    11    --disable-hash
    12    --disable-queue
    13    --disable-replication
    14    --disable-statistics
    15    --disable-verify
    16    --disable-compat185
    17    --disable-cxx
    18    --disable-debug
    19    --disable-debug_rop
    20    --disable-debug_wop
    21    --disable-diagnostic
    22    --disable-dump185
    23    --disable-java
    24    --disable-mingw
    25    --disable-o_direct
    26    --disable-posixmutexes
    27    --disable-pthread_api
    28    --disable-rpc
    29    --disable-smallbuild
    30    --disable-tcl
    31    --disable-test
    32    --disable-uimutexes
    33    --enable-umrw
    34    --disable-shared
    35    --enable-static
    36    --enable-fast-install
    37    --disable-libtool-lock
    38    --disable-largefile

关于configure配置参数的含义,可以运行”../dist/configure –help”查看帮助,这里不再介绍。
要强调的一点是uClibc只能用静态编译,因此一定要选择–disable-shared。
接着执行./myconfig运行配置并编译安装函数库:

linux:/home/work/db/db-4.5.20/build_unix # ./myconfig >/dev/null
configure: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet.  If you think this
configuration is useful to you, please write to autoconf@gnu.org.
cat: /etc/ld.so.conf.d/*.conf: No such file or directory
linux:/home/work/db/db-4.5.20/build_unix # make >/dev/null && make install >/dev/null
../dist/../hmac/sha1.c:96: warning: `R0' redefined
/usr/local/lib/gcc-lib/arm-elf/2.95.3/../../../../arm-elf/include/sys/ucontext.h:40: warning: this is the location of the previous definition
../dist/../hmac/sha1.c:97: warning: `R1' redefined
/usr/local/lib/gcc-lib/arm-elf/2.95.3/../../../../arm-elf/include/sys/ucontext.h:42: warning: this is the location of the previous definition
../dist/../hmac/sha1.c:98: warning: `R2' redefined
/usr/local/lib/gcc-lib/arm-elf/2.95.3/../../../../arm-elf/include/sys/ucontext.h:44: warning: this is the location of the previous definition
../dist/../hmac/sha1.c:99: warning: `R3' redefined
/usr/local/lib/gcc-lib/arm-elf/2.95.3/../../../../arm-elf/include/sys/ucontext.h:46: warning: this is the location of the previous definition
../dist/../hmac/sha1.c:100: warning: `R4' redefined
/usr/local/lib/gcc-lib/arm-elf/2.95.3/../../../../arm-elf/include/sys/ucontext.h:48: warning: this is the location of the previous definition
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
warning: .rodata section contains relocations
strip: /home/work/db/Berkeley.DB/bin/db_archive: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_checkpoint: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_deadlock: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_dump: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_hotbackup: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_load: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_printlog: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_recover: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_stat: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_upgrade: 不可识别的文件格式
strip: /home/work/db/Berkeley.DB/bin/db_verify: 不可识别的文件格式


相关文章:
SQLite3 C/C++ 开发接口简介(API函数) 二
SQLite3 使用教学
Scaling out MySQL - Hardware today and tomorro
SQLite适用的范围
sybase cursor declare
SQL语句大全精要
用户配额
decode函数
Oracle 数据库创建表空间、创建用户指定表空间
MySQL教会我使用GnuPG验证软件包
MySQL中MyISAM引擎与InnoDB引擎性能简单测试
initdb
mysqladmin在线帮助文档
CentOS 4.7 安装Oracle 9.2.0.4的一些问题
文本如何导入oracle(sqlldr 的用法)
ORA-00600: 内部错误代码,自变量: [16201], [],
分布式Oracle的database link
install a MySQL source distribution
Mysql备份脚本(未验证)
oracle 9.2.0.1 update 9.2.0.5
每小时Dump所有mysql数据库到NAS存储设备上
Oracle SCN机制解析
Account LOCKED(TIMED)
MySQL数据库5.0的my.cnf配置选项
oracle存储过程中调用其他用户的表
修改sqlplus提示符
MYSQL建表实例
一些对Mysql DBA有用的脚本
Oracle DBA 强悍挑战OS 64位 Solaris 10-真正休
[Bugzilla]由Mysql迁移到Oracle的方法