sqlite3 development environment construction

  SQLite, a lightweight database, is a relational database management system that complies with ACID. Its design goal is embedded, and its resource consumption is very low. In embedded devices, only a few hundred K of memory may be needed. enough. It can support mainstream operating systems such as Windows/Linux/Unix, and can be combined with many programming languages, such as Tcl, C#, PHP, Java, etc., as well as ODBC interfaces. In terms of well-known database management systems, its processing speed is faster than all of them.

  This article documents the process of installing the sqlite3 development environment and cross-compilation environment on Ubuntu.

1. Download the sqlite3 source code

  Official website address: http://www.sqlite.org/download.html

  

This release provides configure scripts, Makefiles, and more.

2. First install to the x86 environment under Ubuntu

1 cd sqlite-autoconf- 3230100 / #Enter the main source directory
 2  sudo ./ configure #Use the default configuration, where you can specify the installation directory and compiler
 3  sudo  make  
4  sudo  make  install

Observing the output information during the installation process, we can see that the installation paths of related files are as follows:

Executable files; /usr/local/bin
library files: /usr/local/lib
header files: /usr/local/include

Enter in the command line: sqlite3, as shown in the figure below, indicating that the installation is successful.

Compile the test file command: gcc -o name name.c -lsqlite3

At this point, you can write sqlite applications under Ubuntu.

3. Install the embedded development environment

  1), compile the ARM version

1 cd /usr/local/ opt
 2 #Create  an installation directory, put it in the same directory for the convenience of management and cross toolchain, and compile the code on the pc to use the content of this directory
 3  mkdri sqlite3 
 4  
5 cd sqlite-autoconf- 3230100 /
 6 #--host specifies the compiler -- prefix specifies the installation directory
 7  sudo ./configure --host=arm-none-linux-gnueabi --prefix=/usr/local/opt/sqlite3

   2), copy the executable and library files to the development board

1 cp /usr/local/opt/sqlite3/bin/sqlite3 /usr/local/bin
2 cp /usr/local/opt/sqlite3/lib/libsqlite3.so.0.8.6 /usr/local/lib
3 cd usr/local/lib
4 ln -s libsqlite3.so.0.8.6 libsqlite3.so.0
5 ln -s libsqlite3.so.0.8.6 libsqlite3.so

Make sure /usr/local/bin is included in $PATH, and enter sqlite3 on the command line, as follows:

The installation is successful.

Compile test file command: arm-none-linux-gnueabi-gcc -o name name.c -I /usr/local/opt/sqlite3/include -L /usr/local/opt/sqlite3/lib -lsqlite3

-I specifies the header file path, -L specifies the library file path, and the library specified by -lsqlite3 is sqlite3.

question:

  When the executable file is running on the development board, it prompts: : error while loading shared libraries: libsqlite3.so.0: cannot open shared object file: No such file or directory

Reason: The path where libsqlite3.so.0 is stored is not included in the environment variable.

解决:export LD_LIBRARY_PATH="/usr/local/lib"

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325299410&siteId=291194637