Linux ubuntu 編譯安裝boringssl

參考 boringssl 根目錄下的BUILDING.md 安裝相關編譯依賴項

## Build Prerequisites

  * [CMake](https://cmake.org/download/) 2.8.11 or later is required.

  * Perl 5.6.1 or later is required. On Windows,
    [Active State Perl](http://www.activestate.com/activeperl/) has been
    reported to work, as has MSYS Perl.
    [Strawberry Perl](http://strawberryperl.com/) also works but it adds GCC
    to `PATH`, which can confuse some build tools when identifying the compiler
    (removing `C:\Strawberry\c\bin` from `PATH` should resolve any problems).
    If Perl is not found by CMake, it may be configured explicitly by setting
    `PERL_EXECUTABLE`.

  * On Windows you currently must use [Ninja](https://ninja-build.org/)
    to build; on other platforms, it is not required, but recommended, because
    it makes builds faster.

  * If you need to build Ninja from source, then a recent version of
    [Python](https://www.python.org/downloads/) is required (Python 2.7.5 works).

  * On Windows only, [Yasm](http://yasm.tortall.net/) is required. If not found
    by CMake, it may be configured explicitly by setting
    `CMAKE_ASM_NASM_COMPILER`.

  * A C compiler is required. On Windows, MSVC 14 (Visual Studio 2015) or later
    with Platform SDK 8.1 or later are supported. Recent versions of GCC (4.8+)
    and Clang should work on non-Windows platforms, and maybe on Windows too.
    To build the tests, you also need a C++ compiler with C++11 support.

  * [Go](https://golang.org/dl/) is required. If not found by CMake, the go
    executable may be configured explicitly by setting `GO_EXECUTABLE`.

  * To build the x86 and x86\_64 assembly, your assembler must support AVX2
    instructions and MOVBE. If using GNU binutils, you must have 2.22 or later.

修改boringssl 根目錄下的CMakeLists.txt:

對所有的 CMAKE_C_FLAGS 和 CMAKE_CXX_FLAGS 像如下添加 -g3, 生成有調試信息的庫文件:

set(CMAKE_C_FLAGS   "-g3 -Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
set(CMAKE_CXX_FLAGS "-g3 -Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")

## Building

Using Make (does not work on Windows):

    mkdir build
    cd build
    cmake ..
    make
 

在build目錄下分別生成如下庫文件:

build/crypto/libcrypto.a

build/ssl/libssl.a

在build 目錄下執行如下命令, 將庫文件安裝到系統:

$sudo cp ./crypto/libcrypto.a /usr/local/lib/
$sudo cp ./ssl/libssl.a /usr/local/lib/

在boringssl 根目錄下執行如下命令,將頭文件安裝到系統:

$sudo cp include/openssl/* /usr/local/include/openssl/

從新編譯應用程序

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章