移植libzdb3.2.2到arm

一、下载库压缩包并解压

http://www.tildeslash.com/libzdb/#home
http://www.tildeslash.com/libzdb/dist/libzdb-3.2.2.tar.gz
tar -xvf /mnt/hgfs/share/libzdb-3.2.2.tar.gz -C ./

二、导入交叉编译工具链环境变量

export PATH=$PATH:/opt/toolchain-3.4.x/bin/

三、配置与安装

./configure --host=mipsel-linux-uclibc --prefix=/home/wxx/work/test/sqlite3/libzdb-3.2.2/install/

问题1:

configure: error: cannot run test program while cross compiling

解决问题1:

屏蔽掉所有出现该错误的地方(一共两处):

 重新配置,出现问题2:

checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking setjmp is available... configure: error: cross-compiling: please set 'libzdb_cv_setjmp_available=yes|no'

解决问题2:(重新添加配置参数--cache-file=mipsel-linux.cache)

echo libzdb_cv_setjmp_available=yes>>mipsel-linux.cache
echo libzdb_cv_vsnprintf_c11_conformant=yes>>mipsel-linux.cache

./configure --host=mipsel-linux-uclibc --prefix=/home/wxx/work/test/sqlite3/libzdb-3.2.2/install/ --cache-file=mipsel-linux.cache

重新配置出现问题3:

configure: WARNING: mysql_config is required to build libzdb with mysql
checking for oracle... checking if Oracle support is enabled... no
configure: error: No available database found or selected. Try configure --help

解决问题3:

找到sqlite3的库路径并通过--with-sqlite来指定

./configure --host=mipsel-linux-uclibc --prefix=/home/wxx/work/test/sqlite3/libzdb-3.2.2/install/ --cache-file=mipsel-linux.cache --with-sqlite=/home/wxx/work/test/sqlite3/libzdb-3.2.2/sqlite3

 重新配置出现问题4:

checking for /home/wxx/work/test/sqlite3/libzdb-3.2.2/sqlite3... configure: error: cannot check for file existence when cross compiling

解决问题4:

屏蔽掉所有出现该问题的地方(检测环境交叉编译环境用,可以屏蔽掉)

 重新执行configure,成功:

四、编译安装

执行make出现问题5:

./tools/bin/filterh < src/zdb.h > zdb/zdb.h || exit 1
/bin/bash: ./tools/bin/filterh: cannot execute binary file: Exec format error
make: *** [Makefile:1251: zdb/zdb.h] Error 1

解决问题5:

重新打开一个终端,在另外一个地方重新解压压缩包,执行“./configure”生成适合在宿主机运行的“./tools/bin/filterh”,并替换交叉编译环境的“filterh”

重新执行make编译出现问题6:

libtool: compile:  mipsel-linux-uclibc-gcc -DHAVE_CONFIG_H -I. -I./src -I/home/wxx/work/test/sqlite3/libzdb-3.2.2/sqlite3/include -Isrc -Isrc/util -Isrc/net -Isrc/db -Isrc/db/oracle -Isrc/exceptions -Wno-expansion-to-defined -Wno-nullability-completeness -Wno-address -Wno-pointer-sign -g -O2 -D_GNU_SOURCE -Wall -Wunused -Wno-unused-label -funsigned-char -c src/util/Vector.c  -fPIC -DPIC -o src/util/.libs/Vector.o
src/util/Vector.c: In function 'Vector_insert':
src/util/Vector.c:94: error: 'for' loop initial declarations are only allowed in C99 mode
src/util/Vector.c:94: note: use option -std=c99 or -std=gnu99 to compile your code
src/util/Vector.c: In function 'Vector_remove':
src/util/Vector.c:123: error: 'for' loop initial declarations are only allowed in C99 mode
src/util/Vector.c: In function 'Vector_map':
src/util/Vector.c:161: error: 'for' loop initial declarations are only allowed in C99 mode
At top level:
cc1: warning: unrecognized command line option "-Wno-nullability-completeness"
cc1: warning: unrecognized command line option "-Wno-expansion-to-defined"

解决问题6:

修改Makefile,在mipsel-linux-uclibc-gcc后面添加-std=c99

 重新执行make编译,出现问题7:

mipsel-linux-uclibc-gcc -DHAVE_CONFIG_H      -I../src -I../src/util -I../src/net -I../src/db -I../src/exceptions -Wno-expansion-to-defined -Wno-nullability-completeness -Wno-address -Wno-pointer-sign -g -O2 -D_GNU_SOURCE -Wall -Wunused -Wno-unused-label -funsigned-char -c -o pool.o pool.c
pool.c: In function 'testPool':
pool.c:589: error: 'for' loop initial declarations are only allowed in C99 mode
pool.c:589: note: use option -std=c99 or -std=gnu99 to compile your code
pool.c:595: error: redefinition of 'i'
pool.c:589: note: previous definition of 'i' was here
pool.c:595: error: 'for' loop initial declarations are only allowed in C99 mode
pool.c:605: error: redefinition of 'i'
pool.c:595: note: previous definition of 'i' was here
pool.c:605: error: 'for' loop initial declarations are only allowed in C99 mode
At top level:
cc1: warning: unrecognized command line option "-Wno-nullability-completeness"
cc1: warning: unrecognized command line option "-Wno-expansion-to-defined"
make[2]: *** [Makefile:428: pool.o] Error 1

后面的出错都是test目录的出错,可以忽略,直接执行make install生成库文件:

done 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

酣楼驻海

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值