移植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:

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

移植libzdb3.2.2到arm_第1张图片

移植libzdb3.2.2到arm_第2张图片

 重新配置,出现问题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来指定

移植libzdb3.2.2到arm_第3张图片

./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,成功:

移植libzdb3.2.2到arm_第4张图片

四、编译安装

执行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 

你可能感兴趣的:(libzdb,数据库,sqlite3)