[英]How do I compile boost using a specific VC++ Runtime?
我試圖獲得一致的VC ++運行時進行分發,但是我找不到任何強迫boost / bjam合作的東西。
我已經使用此鏈接中的方法成功編譯了libcurl和UnitTest ++。
一般策略是在所有cpp文件中都包含此標頭。
#ifndef __midl
#define _SXS_ASSEMBLY_VERSION "8.0.50727.762"
#define _CRT_ASSEMBLY_VERSION _SXS_ASSEMBLY_VERSION
#define _MFC_ASSEMBLY_VERSION _SXS_ASSEMBLY_VERSION
#define _ATL_ASSEMBLY_VERSION _SXS_ASSEMBLY_VERSION
#ifdef __cplusplus
extern "C" {
#endif
__declspec(selectany) int _forceCRTManifest;
__declspec(selectany) int _forceMFCManifest;
__declspec(selectany) int _forceAtlDllManifest;
__declspec(selectany) int _forceCRTManifestRTM;
__declspec(selectany) int _forceMFCManifestRTM;
__declspec(selectany) int _forceAtlDllManifestRTM;
#ifdef __cplusplus
}
#endif
#endi
b2
具有用於設置cxxflags的選項,盡管它們似乎不支持我的/FI
編譯選項使用標頭並強制正確的運行時。 我認為他們正在使用其他東西。 我想boost不使用msvc標志?
我想專門用8.0.50727.762
編譯boost。
顯然,bjam對於哪個標志領先--
破折號)總是感到困惑。
bjam ^
toolset=msvc-8.0 ^
link=static ^
cxxflags=/FI"C:/boost_1_44_0/sxs_header.h" ^
--with-thread ^
--with-date_time ^
--with-system ^
-d2
將產生正確的編譯器標志:
file bin.v2\libs\thread\build\msvc-8.0\release\link-static\threading-multi\win32\thread.obj.rsp
"libs\thread\src\win32\thread.cpp"
-Fo"bin.v2\libs\thread\build\msvc-8.0\release\link-static\threading-multi\win32\thread.obj"
-TP
/O2
/Ob2
/W3
/GR
/MD
/Zc:forScope
/Zc:wchar_t
/wd4675
/EHs
/FIC:/boost_1_44_0/sxs_header.h
-c
-DBOOST_ALL_NO_LIB=1
-DBOOST_THREAD_BUILD_LIB=1
-DNDEBUG
"-I."
compile-c-c++ bin.v2\libs\thread\build\msvc-8.0\release\link-static\threading-multi\win32\thread.obj
call "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >nul
cl /Zm800 -nologo @"bin.v2\libs\thread\build\msvc-8.0\release\link-static\threading-multi\win32\thread.objp"
thread.cpp
您可以通過創建一個測試應用程序進行驗證,該應用程序使用需要提升鏈接的功能,然后在中間目錄中檢查其清單文件。
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
</assembly>
您應該只看到具有正確版本的一個assemblyIdentity
,否則通常會有一對編號更高的夫婦。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.