SQLite, a lightweight database that adheres to the acid-related database management system, is designed to be embedded and is now used in many embedded products It occupies very low resources, in the embedded device, may only need hundreds of K of memory is enough. It can support Windows/linux/unix and so on mainstream operating system, and can be combined with many programming languages, such as TCL, C #, PHP, Java, and ODBC interface, also compared to MySQL, PostgreSQL, the two open source world-renowned database management system, is processing faster than they do.
Before we start, we need to confirm that there are
- SQLite3 source package;
- Have cross-compiling environment;
- There is a development board;
1. Download SQLite3 Source code Address: http://www.sqlite.org/download.html <ignore_js_op> Choose a stable version of the source code
2. Copy the source package to the host working directory As my user is the Gary,sqlite version is 3.8. The 5 version of the SQLite version is 3.8.5 version
123456 |
cd
mkdir sqlite3
#在主机(如Ubuntu)创建工作目录
cd sqlite3
#进入工作目录中
cp /media/sda1/sqlite-autoconf-3080500
.
tar
.gz ./
#复制SQLite源码到主机
tar zxvf sqlite-autoconf-3080500.
tar
.gz
#解压
cd sqlite-autoconf-3080500
#进入解压后的目录
|
3. Configure compilation Options
123 |
mkdir .. /install #创建安装目录 export PATH=$PATH: /usr/local/arm-2010q1/bin #交叉编译工具路径加入系统环境变量 . /configure --host=arm-none-linux-gnueabi --prefix= /home/gary/sqlite3/install |
which
- --host: Specify the cross-compilation tool, generally Arm-linux, ARM-LINUX-GNUEABIHF, Arm-none-linux-gnueabi, etc., specifically to the board with the cross-compilation tool corresponding.
- --prefix: Specifies the installation directory, and the compiled files are all placed in the installation directory. Must be an absolute path
4. Compile and install
5. Compress and copy Compress and copy sqlite3 files to USB drive
123 |
cd .. /install/bin arm-none-linux-gnueabi-strip sqlite3 cp libsqlite3.so.0.8.6 /media/sda1 #U盘目录 |
Compress and copy the dynamic library libsqlite3.so.0.8.6 file to the USB drive
123 |
cd .. /lib arm-none-linux-gnueabi-strip libsqlite3.so.0.8.6 cp libsqlite3.so.0.8.6 /media/sda1 |
6. Copying Files Make a link on the Development Board to insert the USB drive into the board, copy the sqlite3 to the/usr/local/bin directory, copy the dynamic library file to the/usr/local/lib directory, and link the dynamic library.
12345 |
cp /media/sda1/sqlite3 /usr/locl/bin cp /media/sda1 libsqlite3.so.0.8.6 /usr/local/lib cd /usr/local/lib ln -s libsqlite3.so.0.8.6 libsqlite3.so.0 ln -s libsqlite3.so.0.8.6 libsqlite3.so |
7. Run SQLite Execute the sqlite3 command on the Development Board and see the following message stating that the sqlite3 transplant was successful!
1234567 |
sqlite3 SQLite version 3.8.5 2014-06-04 14:06:34 Enter ".help" for usage hints. Connected to a transient in -memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> |
Use the. Help to view assistance and use. Quit to exit the SQLite command.
Finally, the Arm-2010q1-202-arm-none-linux-gnueabi compiled sqlite3 image is attached and tested to work correctly on the myd-am335x: <ignore_js_op>sqlite3.zip (444.45 KB, download number: 1528) |
Successfully ported SQLite3 to arm Linux Development Board