Port SQLite in Linux

Source: Internet
Author: User

If you want to talk less, go straight to the topic. Here is the procedure for porting:

1. Transplantation

First download SQLite 3.3.8 from here. The following example shows how to store data in the/root directory.

# Cd/root

# Tar zxvf sqlite-3.3.8.tar.gz

After decompression, A sqlite-3.3.8/subdirectory is generated under the/root directory that contains all the source files and configuration scripts required for compilation. All SQLite3 source code files are located under the sqlite-3.3.8/src/directory. Compiling SQLite3 in a PC environment cannot generate a Makefile file by using the configure script in the sqlite-3.3.8/directory. Instead, you must manually modify the Makefile file. There is a Makefile sample file Makefile. linux-gcc in the sqlite-3.3.8/directory. First, run the following command to copy the file and rename it as Makefile:

# Cp Makefile. linux-gcc Makefile

Next, use vim to open the Makefile file and manually modify the content of the Makefile. First, find the following line in the Makefile file:

TOP = ../sqlite

Modify it:

TOP =.

Find the following line:

TCC = gcc-O6

Modify it:

TCC = arm-linux-gcc-O6

Find the following line:

AR = ar cr

Modify it:

AR = arm-linux-ar cr

Find the following line:

RANLIB = ranlib

Modify it:

RANLIB = arm-linux-ranlib

Find the following line:

MKSHLIB = gcc-shared

Modify it:

MKSHLIB = arm-linux-gcc-shared

Comment out the following line:

TCL_FLAGS =-I/home/drh/tcltk/8.4 linux

Comment out the following line:

LIBTCL =/home/drh/tcltk/8.4 linux/libtcl8.4g. a-lm-ldl

In principle, modifications to Makefile mainly include two aspects: first, replace the compiler and archive tools with the corresponding tools in the Cross tool chain, for example, replacing gcc with arm-linux-gcc, replace ar with ar-linux-ar, and replace ranlib with arm-linux-ranlib. Second, remove the TCL-related compilation options, because by default, bind the Tcl language that will compile SQLite3, but it is not required when porting it to ARM-Linux. Therefore, comment out two lines related to TCL.

  • 1
  • 2
  • 3
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.