[英]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.