The process of cross-compiling the SQLite-3.3.8 (or SQLite3.3.12) and porting to ARMS3C2410: porting SQLite3.3.8 (or SQLite-3.3.12) to ARM2
The process of cross-compiling the SQLite-3.3.8 (or SQLite3.3.12) and porting to ARMS3C2410: porting SQLite3.3.8 (or SQLite-3.3.12) to ARM2
The process of cross-compiling the SQLite-3.3.8 (or SQLite3.3.12) and porting to ARMS3C2410:
To port SQLite3.3.8 (or SQLite-3.3.12) to the ARM2410 Development Board, in addition to the support of the underlying operating system, you must also have the corresponding cross-compilation tool chain. The ARM2410 Development Board uses ARM-Linux as the underlying operating system. Therefore, you must first install the ARM-Linux tool chain.
1. Create a cross-compilation environment:
Install cross-2.95.3.tar.bz2 to the/usr/arm-linux directory.
Unzip the sqlite-3.3.8 to/home/sqlite-3.3.8 and create a folder
Cd/home/sqlite-3.3.8
Mkdir sqlite-arm-linux
2. modify part of the configure file under the/home/sqlite-3.3.8 directory
In this way, configure does not check your cross-compilation environment. Otherwise, the following error may occur:
Checking for/usr/include/readline. h... configure: error: cannot check for file existence when cross compiling, Makefile files cannot be generated.
20420 rows {(exit 1); exit 1 ;};}changed to {(echo 1); echo 1 ;};}
20446 rows {(exit 1); exit 1 ;};}changed to {(echo 1); echo 1 ;};}
Cd/home/sqlite-3.3.8/sqlite-arm-linux
../Configure -- disable-tcl -- prefix =/home/sqlite-arm-linux/-- host = arm-linux
Makefile is generated, which will be used in make.
3. Run the following statement in the Makefile file:
BCC = arm-linux-gcc-g-O2
Changed:
BCC = gcc-g-O2
4. Set the cross-compilation environment
Export PATH =/usr/arm-linux/arm/2.95.3/arm-linux/bin: $ PATH
Set config_TARGET_CC and config_BUILD_CC environment variables. Config_TARGET_CC is a cross compiler, and config_BUILD_CC is a host Compiler:
Export config_BUILD_CC = gcc
Export config_TARGET_CC = arm-linux-gcc
5. Compile and install
Make & make install
If no error occurs, the library file is generated in
/Home/sqlite-3.3.8/sqlite-arm-linux/lib directory,
The library file has been generated. You can use strip to reduce the execution file size and remove the debugging information.
Arm-linux-strip libsqlit3.so. 0.8.6
File sqlite3
Sqlite3: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped
The generated sqlite file has not been strip yet. Run the arm-linux-strip command to remove the debugging information, which reduces the number of files. (I do not know why I cannot implement this step, but it does not affect the use of the software)
Arm-linux-strip sqlite3
Run the file command again to view sqlite3 information:
File sqlite3
Sqlite3: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), stripped
This is the executable file that can be run directly on the Development Board.
6. Porting
Note:
To copy a file, you must add the-Arn option because libsqlite3.so and libsqlite3.so. 0 are linked to libsqlite3.so. 0.8.6.
Cd/home/sqlite-3.3.8/sqlite-arm-linux/lib
Cp-ASON libsqlite3.so libsqlite3.so. 0. libsqlite3.so. 0.8.6/usr/qt-sqlite/lib
Cd/home/sqlite-3.3.8/bin
Cp sqlite3/usr/qt-sqlite
Then, port the library files under sqlite3 and lib to the ARM.
7. Run sqlite on the ARM Board
Download the qlite3 file to your arm board,
There are many methods, you need to choose according to your own situation. Such as ftp, nfs, and serial port. OK, start running
Chmod + wx sqlite
[Root @] #./sqlite3 zieckey. db
./Sqlite3: error while loading shared libraries: libsqlite3.so. 0: cannot open shared object file: No such file or directory
This is because the library is compiled in the form of dynamic connection, and all the library files are downloaded to the ARM board.
Download all files in the/usr/local/arm-linux/sqlite-arm-linux/lib directory to the ARM board. Run again,
[Root @] #./sqlite3 zieckey. db
./Sqlite3: error while loading shared libraries: libsqlite3.so. 0: cannot open shared object file: No such file or directory
An error occurred. Oh, we didn't set the environment variable,
Assume that the library file is in the/usr/qpe/lib/directory on the ARM board, and the Environment is set as follows:
[Root @] # export LD_LIBRARY_PATH =/usr/qpe/lib: $ LD_LIBRARY_PATH. Then you can run it:
[Root @] #./sqlite3
SQLite version 3.3.8
Enter ". help" for instructions
Sqlite>
See
Sqlite>
No hint? Succeeded. Haha !!
Click ". help" to see the command :-)
Sqlite>. help
Okay. Now sqlite is running in arm-linux. How is it? It feels very high.