嵌入式Linux之我行——嵌入式資料庫SQLite在2440上的移植

來源:互聯網
上載者:User

一、開發環境:

Mini2440,

Linux_2.6.32.2核心,

Ubuntu 9.10,

arm-linux-gcc-4.3.2

下載sqlite原始碼sqlite-3.6.22.tar.gz

二、移植步驟

1.解壓資料庫源檔案並進入解壓後的目錄,如下:

tar -zxvf sqlite-3.6.22.tar.gz cd sqlite-3.6.22

2.建立一個目錄build並進入該目錄,用於在這個目錄中進行交叉編譯,如下:

mkdir build

cd build

3.在build目錄中運行sqlite-3.6.22中的configure指令碼產生Makefile檔案,如下:

../configure --host=arm-linux --prefix=/root/sqlite-3.6.22/build/target

選項host指定的是用arm交叉編譯器進行編譯選項prefix後面的路徑是到時候編譯安裝後目標存放的目錄,你可以任意設定

4.執行make和make install命令,如下:

make

make install

編譯和安裝完後,在/root/sqlite-3.6.22/build/target目錄中會產生三個目標檔案夾,分別是:

bin、include、 lib,

然後分別將bin下的檔案下載到開發板的/usr/bin目錄中,

lib下的所有檔案下載到開發板的/usr/lib目錄中即可。i

nclude 目錄下是sqlite的C語言API的標頭檔,編程時會用到。

5.在開發板上測試移植的sqlite資料庫。登入開發板的Linux,執行:

sqlite3 demo.db

sqlite3是一個sqlite的命令列訪問程式,demo.db是建立的資料庫的名字,必須以db作尾碼。然後會看到下面的畫面,說明移植成功。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.