Compiling OpenSSL on Linux

OpenSSL
OpenSSL is a replacement for SSLeay secure socket layer.
This document reflects my real-world experience in building OpenSSL 0.9.4 (~1.6M) on a Slackware 4.0 Linux 2.2.10 box. A new version appears to come out every two or three months.
Obtaining OpenSSL
OpenSSL Tarball page at http://www.openssl.org/source/ will show you a list of mirror sites you can obtain the latest from. Again, these instructions pertain to just the openssl-0.9.4.tar.gz version.
Untaring
To untar the file, execute tar zxvf openssl-0.9.4.tar.gz. This will produce a subdirectory called openssl-0.9.4 with everything you need inside.
Installation instructions are convienently in a file called INSTALL, this file can be viewed with less INSTALL.
Configuring
Change into the openssl-0.9.4 directory with:
$ cd openssl-0.9.4
Start the configuration process to identify your platform and its capabilities:
$ ./config
To build the software, simply make it:
$ make
...the compile process will take a while to complete...
Test the build to make sure it worked:
$ make test
Now the big step, installing. You'll need to be root in order to do this next phase:
# make install
You'll find your new software is now located in /usr/local/ssl, be sure to check out the bin and include subdirectories. See the INSTALL and README files that explain how you need to specify #include in your source since the include files moved to a subdirectory.
This page last updated       


2 Get openssl directory installed and version info

# which openssl
/usr/bin/openssl

# /usr/bin/openssl version
OpenSSL 0.9.4 14 Mar 2012


Cross platform compile x86 Android version Openssl on Ubuntu

1>下载NDK Linux版本并解压缩

2> 设置工具链

./android-ndk-r10/build/tools/make-standalone-toolchain.sh--platform=android-19 --install-dir=/tmp/my-android-toolchain --arch=x86

export PATH=/tmp/my-android-toolchain/bin:$PATH

export CC=i686-linux-android-gcc

export CXX=i686-linux-android-g++

3> 切换到openssl根目录,配置

    ./config

    ./Configure os/compiler:android-x86      

    这里是target是x86 Android,所以选了flag android-x86。但是似乎选择任意flag都可以,选择这个flag主要是为了将Makefile中的与当前  host机器相关的编译选项去掉,然后能顺利编译。

4> make


http://mobilepearls.com/labs/native-android-api/ndk/docs/STANDALONE-TOOLCHAIN.html

你可能感兴趣的:(Compiling OpenSSL on Linux)