Reference: http://www.linuxidc.com/Linux/2011-11/47465.htm
Sqlite3 Compiling and installing
------------------------Arm Version----------------------
1. Download sqlite-autoconf-3070602.tar.gz from the official website
2. Unzip, enter the current directory
3. Start the configuration and execute the command as follows (if the cross-compilation environment is configured):
./configure--prefix=/usr/local/sqlite_arm--host=arm-linux
4. Start compiling, execute the command as follows:
Make
5. Start the installation and execute the following commands:
Make install
6. After installation, enter/usr/local/sqlite_arm, there is something (bin Lib include share)
Build instructions successfully installed
7. Copy the entire installation file Sqlite_arm to the Development Board
8. Enter the bin directory of the Sqlite_arm and configure the environment as follows:
Export Ld_library_path=/mnt/sqlite3_arm/lib: $LD _library_path
9. Execute the command:
./sqlite3
If the Sqlite3 version is displayed successfully, the migration to Sqlite3 succeeds.
-------------------sqlite3 Static Library-----------------
1. After installing the arm version of Sqlite3, go to the installation directory Sqlite3_arm The Lib directory, the contents are as follows
libsqlite3.a libsqlite3.so libsqlite3.so.0.8.6
Libsqlite3.la libsqlite3.so.0 Pkgconfig
2. Copy the libsqlite3.a to your own application directory (for example, my Qtcreator application test_sqlite_static)
At the same time copy the Sqlite3_arm's include directory under Sqlite3.h to Test_sqlite_static
3. Under the Test_sqlite_static.pro configuration list in Qtcreator, add the following:
LIBS +=-l/root/test_sqlite_static/
Lsqlite3
4. Add the existing header files to the project at the same time sqlite3.h
5. The main program main.cpp is as follows:
#include <QtCore/QCoreApplication> #include "sqlite3.h" #include <stdio.h> #include <stdlib.h>int Main (int argc, char *argv[]) { qcoreapplication A (argc, argv); Sqlite3 *db=null; char *zerrmsg=0; int RC; rc = Sqlite3_open ("test.db", &db); if (RC) { fprintf (stderr, "Can ' t open database:%s/n", sqlite3_errmsg (db)); Sqlite3_close (db); return 0; } else printf ("You have already successfully!/n"); Sqlite3_close (db); return a.exec (); Exit (1);}
6. QT version in the build settings item in projects in Qtcreator is set to qt/e version
7. Compile the program and then copy the program to the Development Board, requiring the library:
Libqtcore.so.4 libqtnetwork.so.4 libqttest.so.4
8. Run the program./test_sqlite_static, success in the current directory has test.db file generation
Attention:
Make error:
"arm-none-linux-gnueabi-gcc:3.7.6.2": No such file or directory "
Makefile 127 lines of "3.7.6.2" space caused, remove the ' 3 ' before the space, compiled through.
Linux QT uses sqlite static compile library (GO)