1. 程式人生 > >最近編譯POCO 庫和 Boost庫的筆記

最近編譯POCO 庫和 Boost庫的筆記

html pre inf runt eve git tst htm library

最近在編譯POCO庫和BOOST庫

先講一下編譯POCO庫,我編譯的是1.9.0,過程相當曲折,要OPENSSL修改版本的,個OPENSSL在這裏下載,如果你用一般未修改的OPENSSL 是編譯不了,會出現大量錯的

https://github.com/pocoproject/openssl

編譯好後還要下載一個MYSQL 開發版本,一般是ZIP包,300多M的,要註意,如果你要編譯32位POCO,就要下載MYSQL 32位,如果編譯64位POCO,就要64位的MYSQL

然後修改 buildwin.cmd

主要修改下面兩個地方

rem Change OPENSSL_DIR to match your setup set OPENSSL_DIR=D:\opensourcelibrary\CPP\openssl-develop\VS_150 set OPENSSL_INCLUDE=%OPENSSL_DIR%\include set OPENSSL_LIB=%OPENSSL_DIR%\win32\lib\debug;%OPENSSL_DIR%\win32\lib\release;%OPENSSL_DIR%\win32\bin\debug;%OPENSSL_DIR%\win32\bin\release; set INCLUDE=%INCLUDE%;%OPENSSL_INCLUDE% set LIB=%LIB%;%OPENSSL_LIB%
rem Change MYSQL_DIR to match your setup set MYSQL_DIR=D:\mysql set MYSQL_INCLUDE=%MYSQL_DIR%\include set MYSQL_LIB=%MYSQL_DIR%\lib\;%MYSQL_DIR%\lib\debug set INCLUDE=%INCLUDE%;%MYSQL_INCLUDE% set LIB=%LIB%;%MYSQL_LIB% 修改完按照自己的VS版本進行執行,比如我是VS 2017 是 VC 150 版本,我就執行build_vs150.cmd,如無意外就編譯成功 再講一下編譯boost 庫,要編譯winXP可以用的,我就這樣做 先下載一個boost_1_68_0.zip 然後解壓,然後執行如下
d:
cd d:\boost_1_68_0 d:\boost_1_68_0>
D:\boost_1_68_0>bootstrap.bat
Building Boost.Build engine
Bootstrapping is done. To build, run:
    .\b2
To adjust configuration, edit ‘project-config.jam‘.
Further information:
    - Command line help:
    .\b2 --help
    - Getting started guide:
    http://boost.org/more/getting_started/windows.html

    - Boost.Build documentation:
    http://www.boost.org/build/doc/html/index.html
然後再執行如下 如果你是編譯 32位,這裏是VS 2017為例子,因為是ms-vc 14.1版本,根據自己的VS版本填入適當的參數,我這裏用了b2的命令,網上也有用bjam的,等下再講
b2.exe toolset=msvc-14.1 link=static runtime-link=static,shared --build-dir=build/x86 address-model=32 -j5 install --includedir=d:\boost_1_68_0\win32\include --libdir=D:\opensourcelibrary\CPP\boost_1_68_0\win32\lib\x86 define=BOOST_USE_WINAPI_VERSION=0x0501
最後的 define=BOOST_USE_WINAPI_VERSION=0x0501 是指明XP下面也可以用的,如果你不需要XP也可以把那個參數刪除,默認是WIN7的

如果你是編譯64位,這個命令
b2.exe toolset=msvc-14.1 link=static runtime-link=static,shared --build-dir=build/x64 address-model=64 -j5 install --includedir=:\boost_1_68_0\win64\include --libdir=:\opensourcelibrary\CPP\boost_1_68_0\win64\lib\x64

最近編譯POCO 庫和 Boost庫的筆記