Install SQLite database on the host PC
1. Download and decompress the source code of the SQLite Database
Here the SQLite database version is used in sqlite-3.5.9, is: unzip Linux operating system/root directory, and then in the terminal to enter the root and unzip, the Operation Command is as follows:
[Root @ localhost/] # cd/root
[Root @ localhost root] # tar zxvf sqlite-3.5.9.tar.gz
This generates a sqlite-3.5.9 directory in the/root directory.
2. Generate the SQLite configuration file, compile and install SQLite
Go to the sqlite-3.5.9 directory, and use the default configuration to generate the MAKEFILE file, and then compile and install SQLite, the Operation Command is as follows:
[Root @ localhost root] # cd sqlite-3.5.9;
[Root @ localhost sqlite-3.5.9] #./configure;
[Root @ localhost sqlite-3.5.9] # make;
[Root @ localhost sqlite-3.5.9] # make install;
This will generate the bin, include, and Lib directories in/usr/local (which is the default installation path) of the fedora7 Linux operating system, the files in the bin directory are SQLite executable files sqlite3; the files in the include directory are libsqlite3.a, libsqlite3.la, libsqlite3.so, and libsqlite3.so. 0 and libsqlite3.so. 0.8.6; the file in the lib directory is sqlite3.h, which is the SQLite header file.
3. Test the SQLite Database
Because SQLite is installed in the default path/usr/local, you only need to enter sqlite3 directly on the terminal. The following output indicates that the SQLite database is successfully installed.
[Root @ localhost sqlite-3.5.9] # sqlite3
SQLite version 3.5.9
Enter ". Help" for instructions
SQLite>
Install the SQLite database in the Cross-compilation environment
1. Download and decompress the source code of the SQLite Database
Here the SQLite database version used is sqlite-3.5.9, is: customized Linux operating system/usr/local/ARM directory, and then in the terminal to enter/usr/local/ARM and unzip, the command is as follows:
[Root @ localhost/] # cd/usr/local/arm;
[Root @ localhost arm] # tar zxvf sqlite-3.5.9.tar.gz;
This generates a sqlite-3.5.9 directory in the/usr/local/ARM directory.
1. Generate the SQLite configuration file, compile and install SQLite
Unlike sqlite3 compilation in a PC environment, makefile files cannot be generated through the configure script in the sqlite-3.5.9 directory. Instead, you must manually modify the MAKEFILE file. In the sqlite-3.5.9 directory, there is a makefile sample file named makefile. Linux-GCC, modify this file and rename it makefile, the Operation Command is as follows:
[Root @ localhost arm] # cd sqlite-3.5.9; // enter the sqlite-3.5.9 directory
[Root @ localhost sqlite-3.5.9] # cp makefile. Linux-gccmakefile; // copy a MAKEFILE file
[Root @ localhost sqlite-3.5.9] # gedit makefile; // modify the MAKEFILE file File
To modify makefile, replace the compiler and archive tools with the corresponding tools in the Cross tool chain, for example, replacing GCC with arm-Linux-GCC; next, remove the Tcl-related compilation options, because by default, the TCL language for sqlite3 compilation will be bound, but it is not required to port sqlite3 to the arm-Linux cross-compilation environment, two TCL-related content must be commented out. The specific modification is as follows:
Change the code "Top = ../SQLite" in line 3 to "Top = .";
Change the code "TCC = gcc-o6" in line 3 to "TCC = arm-Linux-gcc-o6 ";
Change the code "Ar = ar Cr" in line 2 to "Ar = arm-Linux-ar Cr ";
Change the code "ranlib = ranlib" in line 1 to "ranlib = arm-Linux-ranlib ";
Change "mkshlib = gcc-shared" of the Code to "mkshlib = arm-Linux-gcc-shared" of Line 3 ";
Comment out the code "tcl_flags =-I/home/DRH/tcltk/8.4linux" in line 3;
Comment out the code "libtcl =/home/DRH/tcltk/103rd Linux/libtcl8.4g. A-lm-LDL" in line 8.4;
Save and exit, and then modify the main. mk file. The operation command is as follows:
[Root @ localhost sqlite-3.5.9] # gedit main. mk // modify the main. mk File
Modify the code "Select. O table. otclsqlite. O tokenize. O trigger. O \" in line 63rd to "Select. O table. O tokenize. otrigger. O \";
Save and exit. Now all the file modifications have been completed. Compile SQLite and run the following command:
[Root @ localhost sqlite-3.5.9] # make;
After compilation, libsqlite3.a, sqlite3.h, and sqlite3 files are generated under the current sqlite-3.5.9 Directory, which are SQLite library function files, header files, and application files. Copy the sqlite3 application file to the/nfs/bin directory of the fedora7 Linux operating system, so that SQLite can be used on the embedded development platform (such as a Super Terminal.
3. Test the SQLite Database
Connect the target board of the portable satellite communication earth station monitoring system with the PC, open the Super Terminal on the PC, start the target operating system, and then input sqlite3 on the Super Terminal, the following output indicates that the SQLite database is successfully installed.
[Root @ localhost/] # sqlite3
SQLite version 3.5.9
Enter ". Help" for instructions
SQLite>
Although the method for installing SQLite database in an embedded cross-compilation environment is different from that in a PC environment, the storage format for generating database files in the two environments is the same, the same is true for databases, and the same database can be operated in a PC environment and an embedded environment.