Cross-compiling Sqlcipher

Source: Internet
Author: User

1. Carefully pre-compile macro Sqlite_has_codec

2. OpenSSL under different license, the exported symbols are not equal.

As always, all GNU make-like projects are successfully compiled and installed under Linux Configure+make, but when cross-compiling to the Android Linux platform, the process is always problematic, one to one to solve manually.

1. Carefully pre-compile macro Sqlite_has_codec

Sqlcipher is an enhanced version of Sqlite3 that provides encryption. This is the modified version of Sqlite3, which modifies the added code, and takes some pre-compiled macros to select the route. All modified code fragments are included under precompiled macro Sqlite_has_codec protection. If you do not join this precompiled macro Sqlite_has_codec, this part of the code will not be included in the source file. It must be clear that this part of the code is modified, not newly added. For the new addition is not included in the compilation of a version of the original, but does not include the changes in the code, even the original necessary definition of the structure or code is not included, so the compilation will be error n many things are not defined. And these things are in the source file text.

2. OpenSSL under different license, the exported symbols are not equal.

In your Linux operating system, the Openssl-devel package you use is under [GNU public License], and almost all of the projects that rely on OpenSSL are well-compatible with compiling. But you should be aware that when you download the repository that the OpenSSL code package compiles, it is [OpenSSL license]. These two license are different, not in depth, but affect our compilation compatibility.

The left image is the hmac.h under [OpenSSL License]

The image on the right is the hmac.h under [GNU public License], which is our common Openssl-devel package for Linux operating systems.

In hmac.h under [GNU public License], the struct Hmac_ctx_st exports the header file.

In the hmac.h of [OpenSSL License], the struct hmac_ctx_st is to hide the definition, and the user must dynamically allocate space through Hmac_ctx_new ().

What's the big impact? The problem is that some projects directly aggregate hmac_ctx_st structures in their structures, making it incompatible to compile these projects.

For example, a code snippet such as a Sqlcipher project

This makes you bored, and the OpenSSL package in [GNU public License] can be compiled, but it will be compiled in the OpenSSL library of [OpenSSL License].

The definition of this structure is

Also manually added on that add on that.

Cross-compiling Sqlcipher

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.