Bug #3542
closedBuilding Wt using static boost
Description
Hi,
I'm trying to build Wt 3.3.1 statically in Visual Studio 2010 Windows using Boost 1.53 static libraries and Cmake 3. After Cmake generates the project, I look at the Visual Studio projects:
Configuration Properties~~C/C~~>Code Generation->Runtime Library
It has "Multi-threaded DLL (/MD)" selected instead of "Multi-Threaded (/Mt)". Shouldn't the project be /Mt to use the static versions of boost? When I compile I get the errors like:
9>LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-1_53.lib'
Which is odd, since it is requesting the non-statically linked boost libraries.
Can anyone help me?
-Ethan
Updated by Wim Dumon about 10 years ago
No. MT and MD are flags to select the visual studio runtime library (static or dynamic), and that choice is orthogonal to a static/dynamic boost. You can build a boost dll to static runtime libraries, or a static boost with dynamic runtime libraries. You select this in bjam. Whatever you do, never mix static/dynamic runtime libraries in one project (unless you really know what you're doing, and even then...).
Best regards,
Wim.
Updated by Ethan Chan about 10 years ago
I see, that actually clarified a lot. Thanks.
I'm going to go back and rebuild Boost with static linking. I had used a tool called BlueGo to build Boost for me (http://vertexwahn.de/bluego.html), but I guess it must not have linked statically to the runtime. Sigh. I'll report back.
Thanks Wim!
Updated by Ethan Chan about 10 years ago
I rebuilt Boost with these settings to link statically, but also link to the static runtime:
b2 ---toolset=msvc variant=release link=static threading=multi runtime-link=static
However when building Wt, it was still trying to look for non-statically linked libraries 'libboost_date_time-vc100-mt-1_53.lib'
So then I found out I needed to manually change the setting CMAKE_CXX_FLAGS_RELEASE to use /MT. That seemed to fix the problem. Just curious if this was documented anywhere? Linking can be such a frustrating process.
Updated by Wim Dumon about 10 years ago
- Status changed from New to Resolved
Hey,
I never build with MT. I believe you'll have to dig in the cmake documentation, this is not Wt specific as Wt doesn't impose MT or MD, both should work.
BR,
Wim.
Updated by Koen Deforche about 10 years ago
- Status changed from Resolved to Closed