Xun ported and used the QT system Sqlite3 for the IMX6 development board

This chapter introduces how to port sqlite3 to the  ARM  development board, and use C language to operate sqlite3 on the development board. The relevant supporting information is in the network disk information "iTOP-i.MX6 development board information summary (not including CD-ROM information)\08_iTOP -i.MX6 development board  Linux  system development materials\25-QT system Sqlite3 transplantation and use" directory. Operation source download address:

We directly download the latest version (version 3.32.3), and we put the downloaded compressed package under the document directory:

1 Decompress the downloaded compressed package sqlite-autoconf-3320300.tar.gz and create and install it The directory mkdir install, as shown in the following figure:

2 Enter the decompressed directory and configure the compilation options: ./configure --host=arm-none-linux-gnueabi
--prefix=/home/topeet/iMX6Q/sqlite3/install/.
--host: Specify the cross-compilation tool, which is consistent with the compiler that compiles Linux.
--prefix: Specify the installation directory. The files generated after compilation are placed in this directory. It must be an absolute path.

3 Execute make, as shown in the figure below after completion:

3 Execute make, as shown in the figure below after completion:

5 Check whether the install directory is The required files are generated.

6 Copy the library files in the lib directory to the /lib/ directory of the development board, and copy the sqlite3 in the bin directory to the /bin/ directory of the development board.
7 Enter sqlite3 in the terminal command line of the development board, and it will enter as shown in the figure below:

8 Test:
1 Create a new table, enter create table user (id int, name char, age int); Then query the table, enter .table, and you can find the newly created user table, as shown in Figure 83.9:

2 Create .db File
Enter sqlite3 /path/file name.db After the operation, you must enter .databases.

3 Write C code test:
Now create a table in the database, insert data:
create table demo (id int,name char,age int);
insert into demo values(100,'WangWu',23);
insert into demo values(101,' Tommm',25);
select * from demo; The

C code is as follows, please refer to the demo source code in the directory and

enter the following command to cross compile: arm-none-linux-gnueabi-gcc -I/home/topeet/iMX6Q/sqlite3/install /include/ -L /home/topeet/iMX6Q/sqlite3/install/lib/ -o sql
testSql.c -lsqlite3 -ldl
-I specifies the path where sqlite3.h is located, and
-L specifies the lib library path of sqlite3.

Copy the generated executable file sql to the root directory of the development board.
After execution, you can see the query results:

So far, the porting and simple introduction of sqlite3 is over. Xunwei IMX6Q Development Board

Guess you like

Origin blog.csdn.net/mucheni/article/details/114923305