[Embedded] -- transplantation of SQLite-2.8.17 on fl2440 (redhat9.0 Linux)

Source: Internet
Author: User

(Note: You have transplanted the documents from the Internet and from the books and materials. This is a success !)

Environment: Virtual Machine + RedHat 9.0 Linux

Software: sqlite-2.8.17.tar.gz?cross-2.95.3.tar.gz

 

Steps:

1. Install the Cross Compiler

Copy cross-2.95.3.tar.gz to the:/usr/src/directory and decompress the package with the following command:

# Tar-zxvf cross-2.95.3.tar.gz

After decompression, a directory named "2.95.3" appears in the directory;

Then configure the default path of the Cross Compiler:

# Export Path = $ path:/usr/src/2.95.3/bin

# Source/etc/profile (make the preceding command take effect)

# Arm-Linux-GCC -- version (after entering this command, if the path of the Cross-compilation tool is correctly configured, the published version number should be displayed)

 

II,

1. decompress the source code package

Copy sqlite-2.8.17.tar.gz to the/usr/src/directory and decompress the package.

# Tar-zxvf sqlite-2.8.17.tar.gz

The sqlite-2.8.17 directory will be generated later

 

2. Modify sqliteint. h file

 

In the sqlite-2.8.17/src/directory, there is a sqliteint. in the header file of H, the value of sqlite_ptr_sz is 4, which indicates that btree (B tree) has the correct variable size. Otherwise, the following problems may occur during execution on the arm Development Board:

In File btree. C, the assert (sizeof (PTR) = sizeof (char *) is thrown *));"

Modify the header file and open sqliteint. h In VI or another editor.

# If sqlite_ptr_sz = 4

# Define intptr_type int

# Else

# Define intptr_type long

# Endif

Add the following statement above:

# Define sqlite_ptr_sz 4

Save and exit.

 

3. Modify the configure file

The configure file is in the sqlite-2.8.17/directory. Modify this file so that it does not check the cross-compilation environment, and then execute the configure command to generate the MAKEFILE file.

Comment out: (in vi command mode, directly enter the number of rows and press enter, for example, ": 19153 press ENTER ")

19153 rows-19157 rows

19989 rows-19995 rows

20001 rows

20392 rows-20398 rows

20418-20424 rows

20430 rows

 

4. Generate the MAKEFILE file

 

Create a directory under the/usr/src/directory

# Mkdir armsqlite

# Cd armsqlite

# ../Sqlite-2.8.17/configure-Disable-tcl-host = arm-Linux

If no error occurs, generate makefile and other files. If the C compiler cannot be found, use a later version of the cross compiler.

 

5. Modify the MAKEFILE file

 

Go to the MAKEFILE file and find:

BCC = arm-Linux-gcc-g-O2

Changed:

BCC = gcc-g-O2

Because the executable files generated by the compilation must be run on the host machine.

 

Since the compiled Executable File SQLite must be executed on the arm Development Board, change the library libssqlite. La specified later to libsqlite. A, which is compiled into a static link.

Find "all" and change all later libsqlite. La to libsqlite. A (Note: Do not change libtclsqlite. La)

Save the modification and exit.

 

6. Run the following command in the armsqlite directory:

# Make clean

# Make

Then the required SQLite executable program and other related files will be generated in this directory.

Copy the directory to a directory under the Development Board through mounting or other methods

Then execute:

#./SQLite ex1

If:

SQLite version 2.8.17

Enter "./help" for instructions

SQLite>

The migration is basically successful.

Then test,

SQLite> Create Table tb11 (one varchar (10), two smallint); (if an error occurs after this sentence is entered, press Ctrl + Z and execute again, change ex1 to ex1.db)

SQLite> insert into tb11 values ('Hello! ', 10 );

SQLite> insert into tb11 values ('Goodbye ', 20 );

SQLite> select * From tb11; (if the following structure is displayed after the carriage return, the port is successfully transplanted)

Hello! | 10

Goodbye | 20

Related Article

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.