Sqlite3的應用

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 uploaded sqlite3'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.

發佈了25 篇原創文章 · 獲贊 26 · 訪問量 14萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章