mini6410下移植sqlite3.7.6.3

來源:互聯網
上載者:User

1、 下載SQLite 3.7.6.3,http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz

2 、 解壓到某個檔案夾下
3 、 配置,這裡安裝到當前檔案夾下的sqlite下
./configure CC=/usr/local/arm/4.4.1/bin/arm-linux-gcc  –prefix=./sqlite --disable-tcl --host=arm-linux
4 、make&&make install
    在sqlite下產生bin include lib share檔案
5 、進入bin檔案,執行arm-linux-strip  sqlite3
6 、將bin檔案下的sqlite3執行檔案拷至開發板bin檔案下,lib檔案夾下的所有檔案拷至開發板的/lib檔案夾下
7 、./sqlite3 列印如下

SQLite version 3.7.6.3                                                         
Enter ".help" for instructions                                                 
Enter SQL statements terminated with a ";"                                     
sqlite>

8 、編寫C測試
hello.c
#include<stdio.h><br />#include"sqlite3.h"<br />int main(void)<br />{<br /> const char *dbfile = "test.db";<br /> sqlite3 *pdb = NULL;<br /> int result;<br /> if ((result = sqlite3_open(dbfile, &pdb)) != 0)<br /> {<br /> printf("error: can't open %s/nerrmsg: %s/n", dbfile, sqlite3_errmsg(pdb));<br /> return -1;<br /> }<br /> else<br /> {<br /> printf("opened!/n");<br /> }<br /> if ((result = sqlite3_close(pdb)) != 0)<br /> {<br /> printf("error: can't close %s/nerrmsg: %s/n", dbfile, sqlite3_errmsg(pdb));<br /> return -1;<br /> }<br /> else<br /> {<br /> printf("closed!/n");<br /> }<br /> return 0;<br />}

將編譯產生的.so檔案拷至hello.c檔案夾下
arm-linux-gcc -o  hello{,.c} -L$PWD -lsqlite3
將hello拷至開發板 ./hello
列印:
opened!
closed!
同時產生test.db檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.