sqlite3的应用
软件环境
● PC:Fedora9
● 开发板:YC2440
● 交叉编译器:arm-linux-gcc 3.3.2
● 数据库:sqlite3.2.7
● 源码:http://download.csdn.net/source/2984671
我已经上传了PC下基于sqlite3的“增删改查”的代码。所以对编译和应用不再赘述。
在这里我将花更多的时间描述一下交叉编译过程中出现的问题、原因以及解决办法。
问题1:
系统提示:legacy.o(.text+0x340): undefined reference to `__ctype_b_loc'
系统提示:
/usr/local/arm/4.0.0/usr/bin/../lib/gcc/arm-linux/4.0.0/../../../../arm-linux/bin/ld:
crt1.o: No such file: No such file or directory
系统提示:arm_v5t_le-gcc-ld: ERROR: Source object /libsqlite3.a(set.o) has EABI version 0,but target test has EABI version 5
原因/办法:
交叉编译后,系统做上述提示,如果已经排除了常规原因(缺少某些库等),就应该考虑交叉编译器的版本问题了。
问题2:
系统提示:
arm-linux-gcc -static -g -o all.cgi all.c -L ./lib -lsqlite3 -I ./Include
/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: skipPing incompatible ./lib/libsqlite3.a when searching for -lsqlite3
/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: cannot find -lsqlite3
collect2: ld returned 1 exit status
原因/办法:
交叉编译环境arm-linux-gcc编译链接的libsqlite3.a库不是使用arm-linux-gcc编译获得的,而是使用gcc编译所得。
同样道理,如果使用gcc编译链接的是由arm-linux-gcc编译所得的libsqlite3.a库也会出现类似问题。
问题3:
下载到开发板后,执行程序,提示无法打开数据库。
原因/办法:
权限问题,可以将test.db所在目录到根目录权限全部放开。
sqlite3 Application
Software Environment
● PC: Fedora9
● Development Board: YC2440
● cross-compiler: arm-linux-gcc 3.3.2
● Database: sqlite3.2.7
I have uploadedsqlite3's "add delete update select" code base on PC. So the compiler and applications will not be repeated.
Here I will spend more time describing some problems,causes and solutions what occurred during cross-compilation.
Question 1:
System warning: legacy.o (. Text +0 x340): undefined reference to `__ctype_b_loc '
System warning:
/Usr/local/arm/4.0.0/usr/bin/../lib/gcc/arm-linux/4.0.0/../../../../arm-linux/bin/ld:
crt1.o: No such file: No such file or directory
System warning: arm_v5t_le-gcc-ld: ERROR: Source object / libsqlite3.a (set.o) has EABI version 0,but target test has EABI version 5
Reasons/ways:
After cross compiling,the system shows the above tips,if you have ruled out the conventional reasons (lack of some librarIEs,etc.),you should consIDer that the cross-compiler version is inappropriate.
Question 2:
System warning:
arm-linux-gcc-static-g-o all.cgi all.c -L ./lib-lsqlite3 -I ./Include
/Usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: skipPing incompatible ./lib/libsqlite3.a when searching for-lsqlite3
/Usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: cannot find-lsqlite3
collect2: ld returned 1 exit status
Reasons/ways:
Cross-compiler arm-linux-gcc linked libsqlite3.a not using arm-linux-gcc compiler to build,but useing gcc compiler.
Similarly,if using gcc to link libsqlite3.a by the arm-linux-gcc compiler,the problems will also appear.
Question 3:
Downloaded to the development board,excuting the programmes,system warning that not open the database.
Reasons/ways: Permissions problem,you can assign permission for all directorys from test.db directory to the root directory.
以上是内存溢出为你收集整理的Sqlite3的应用全部内容,希望文章能够帮你解决Sqlite3的应用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)