SQLite compilation in arm-Linux

Source: Internet
Author: User

Development Environment: ubuntu10.04 tq2440
Step 1: Compile SQLite in arm-Linux
1. Download SQLite 2.8.17 : Go to Region
Note: the download is sqlite-2.8.17.tar.gz.
2. confirm that the arm-linux-toolchains.tgz has been installed on your Linux system.
3. To run SQLite properly in arm-Linux, we need to modify a code. Otherwise, the following things will appear when running SQLite on the arm Board:
====================================
An assertion is thrown in file btree. C,
Assert (sizeof (PTR) = sizeof (char *));
====================================
This assertion is to ensure that btree (B-tree) has the correct variable size, such as "PTR" and "char *". In Linux with different architectures, such as x86 and arm, there will be some differences. In the case of arm-Linux :-). So we can make some changes.
Modify SQLite/src/sqliteint. h and find the following parts:
# Ifndef intptr_type
# If sqlite_ptr_sz = 4
# Define intptr_type int
# Else
# Define intptr_type long
# Endif
Add the following sentence before the above Code:
# Define sqlite_ptr_sz 4
In this case, "typedef intptr_type PTR;" is the defined "int" type instead of "long ".
4. Modify configure
Comment out the following lines
19153 rows-19157 rows
# If test "$ cross_compiling" = "yes"; then
# {Echo "$ as_me: $ lineno: Error: unable to find a compiler for building build tools"> & 5
# Echo "$ as_me: Error: unable to find a compiler for building build tools"> & 2 ;}
# {(Exit 1); Exit 1 ;};}
# Fi
19989 rows-19995 rows
# If eval "test \" \$ {$ as_ac_file + set} \ "= set"; then
# Echo $ echo_n "(cached) $ echo_c"> & 6
# Else
# Test "$ cross_compiling" = Yes &&
# {Echo "$ as_me: $ lineno: Error: cannot check for file existence when cross compiling"> & 5
# Echo "$ as_me: Error: cannot check for file existence when cross compiling"> & 2 ;}
# {(Exit 1); Exit 1 ;};}
20001 rows
# Fi
20392 rows-20398 rows
# If eval "test \" \$ {$ as_ac_file + set} \ "= set"; then
# Echo $ echo_n "(cached) $ echo_c"> & 6
# Else
# Test "$ cross_compiling" = Yes &&
# {Echo "$ as_me: $ lineno: Error: cannot check for file existence when cross compiling"> & 5
# Echo "$ as_me: Error: cannot check for file existence when cross compiling"> & 2 ;}
# {(Exit 1); Exit 1 ;};}
20404 rows
# Fi
20418-20424 rows
# If eval "test \" \$ {$ as_ac_file + set} \ "= set"; then
# Echo $ echo_n "(cached) $ echo_c"> & 6
# Else
# Test "$ cross_compiling" = Yes &&
# {Echo "$ as_me: $ lineno: Error: cannot check for file existence when cross compiling"> & 5
# Echo "$ as_me: Error: cannot check for file existence when cross compiling"> & 2 ;}
# {(Exit 1); Exit 1 ;};}
20430 rows
# Fi

If the PC version is compiled:

5. After commenting out, You can execute configure. In the SQL-arm directory, enter the following command:
../SQLite/configure -- Host = arm-Linux
In this way, the makefile and libtool script will be generated in your build directory, which will be used in make.
6. Make and make install;

If you compile the arm version:
5. After commenting out, You can execute configure. In the SQL-arm directory, enter the following command:
../SQLite/configure -- Host = arm-Linux-Prefix =/home/tool/SQLite-arm/build
In this way, the makefile and libtool script will be generated in your build directory, which will be used in make.
6. Modify the MAKEFILE file
Modify the MAKEFILE file.
BCC = arm-Linux-gcc-g-O2
Change:
BCC = gcc-g-O2
Generally, SQLite is run on an arm-Linux hardware board, so we generally compile it into a static link. It is troublesome to share the so library.
So continue to modify the makefile and find the following:
SQLite:
Replace "libsqlite. La"
". Libs/libsqlite."

7. Make make install;

8. copy the files generated under build to the Cross-compiler directory.

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.