Boost C++ Libraries: Ticket #4893: boost_serialization link error under msvc 9.0 https://svn.boost.org/trac10/ticket/4893 <p> I`m trying to compile small program using boost_serialization under msvc. I have three simple cases: </p> <pre class="wiki">1) FAILED! Jamroot: using msvc ; use-project boost : "C:\\Boost\\boost_1_45_0" ; exe serial : serial.cpp /boost/serialization//boost_serialization ; Serial.exe.rsp: "bin\msvc-9.0\debug\threading-multi\serial.obj" "C:\Boost\boost_1_45_0\bin.v2\libs\serialization\build\msvc-9.0\debug\threading-multi\boost_serialization-vc90-mt-gd-1_45.lib" All full paths are exist! msvc.link.dll C:\Boost\boost_1_45_0\bin.v2\libs\serialization\build\msvc-9.0\debug\threading-multi\boost_serialization-vc90-mt-gd-1_45.dll Creating library C:\Boost\boost_1_45_0\bin.v2\libs\serialization\build\msvc-9.0\debug\threading-multi\boost_serialization-vc90-mt-gd-1_45.lib and objec t C:\Boost\boost_1_45_0\bin.v2\libs\serialization\build\msvc-9.0\debug\threading-multi\boost_serialization-vc90-mt-gd-1_45.exp msvc.manifest.dll C:\Boost\boost_1_45_0\bin.v2\libs\serialization\build\msvc-9.0\debug\threading-multi\boost_serialization-vc90-mt-gd-1_45.dll msvc.link bin\msvc-9.0\debug\threading-multi\serial.exe LINK : fatal error LNK1104: cannot open file 'libboost_serialization-vc90-mt-gd-1_45.lib' call "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 &gt;nul link /NOLOGO /INCREMENTAL:NO /DEBUG /MACHINE:X86 /subsystem:console /out:"bin\msvc-9.0\debug\threading-multi\serial.exe" @"bin\msvc-9.0\debug\threading- multi\serial.exe.rsp" if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL% ...failed msvc.link bin\msvc-9.0\debug\threading-multi\serial.exe bin\msvc-9.0\debug\threading-multi\serial.pdb... ...failed updating 2 targets... ...updated 34 targets... 2) FAILED! Jamroot: using msvc ; use-project boost : "C:\\Boost\\boost_1_45_0" ; exe serial : serial.cpp /boost/serialization//boost_serialization : &lt;link&gt;static &lt;runtime-link&gt;static ; All paths from serial.exe.rsp are exist too. ... compile-c-c++ C:\Boost\boost_1_45_0\bin.v2\libs\serialization\build\msvc-9.0\debug\link-static\runtime-link-static\xml_archive_exception.obj xml_archive_exception.cpp compile-c-c++ C:\Boost\boost_1_45_0\bin.v2\libs\serialization\build\msvc-9.0\debug\link-static\runtime-link-static\shared_ptr_helper.obj shared_ptr_helper.cpp msvc.archive C:\Boost\boost_1_45_0\bin.v2\libs\serialization\build\msvc-9.0\debug\link-static\runtime-link-static\libboost_serialization-vc90-sgd-1_45.lib stl_port.obj : warning LNK4221: no public symbols found; archive member will be inaccessible msvc.link bin\msvc-9.0\debug\link-static\runtime-link-static\serial.exe LINK : fatal error LNK1104: cannot open file 'libboost_serialization-vc90-mt-sgd-1_45.lib' call "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 &gt;nul link /NOLOGO /INCREMENTAL:NO /DEBUG /MACHINE:X86 /subsystem:console /out:"bin\msvc-9.0\debug\link-static\runtime-link-static\serial.exe" @"bin\msvc-9.0\ debug\link-static\runtime-link-static\serial.exe.rsp" if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL% ...failed msvc.link bin\msvc-9.0\debug\link-static\runtime-link-static\serial.exe bin\msvc-9.0\debug\link-static\runtime-link-static\serial.pdb... ...failed updating 2 targets... ...updated 32 targets... 3) WORKS! using msvc ; use-project boost : "C:\\Boost\\boost_1_45_0" ; exe serial : serial.cpp /boost/serialization//boost_serialization link&lt;static&gt; ; So where is problem? Is only one possible configuration for building serialization library under msvc? </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4893 Trac 1.4.3 anonymous Thu, 25 Nov 2010 08:22:56 GMT summary changed https://svn.boost.org/trac10/ticket/4893#comment:1 https://svn.boost.org/trac10/ticket/4893#comment:1 <ul> <li><strong>summary</strong> <span class="trac-field-old">boost_serialization link error under msvc 8.0</span> → <span class="trac-field-new">boost_serialization link error under msvc 9.0</span> </li> </ul> Ticket Robert Ramey Thu, 25 Nov 2010 17:14:11 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4893#comment:2 https://svn.boost.org/trac10/ticket/4893#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> I'm pretty sure this isn't a serialization library question but rather a bjam question. So I don't think I can help here. That is, I don't think this can be addressed from the serialization library source code. Try posting this on the boost/build list. </p> <p> Robert Ramey </p> Ticket anonymous Sun, 28 Nov 2010 14:28:20 GMT <link>https://svn.boost.org/trac10/ticket/4893#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4893#comment:3</guid> <description> <p> I can link with other libraries, boost_program_options for instance, but not with boost_serialization. So I think it`s a serialization library problem. Am I right? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 29 Nov 2010 07:18:43 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/4893#comment:4 https://svn.boost.org/trac10/ticket/4893#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">invalid</span> </li> </ul> <p> I have tested thread, regex, program options and other libs. Only the serialization lib doesn`t link. </p> <p> P.S. With msvc 8.0 I have the same results. </p> Ticket anonymous Mon, 29 Nov 2010 20:27:04 GMT <link>https://svn.boost.org/trac10/ticket/4893#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4893#comment:5</guid> <description> <p> I submitted this issue to boost.build (<a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4901" title="#4901: Bugs: boost_serialization link error under msvc 9.0 &amp; 8.0 (closed: wontfix)">#4901</a>) and steven_watanabe said: </p> <p> "You need to add &lt;define&gt;BOOST_ALL_NO_LIB to disable auto-linking. I think other libraries probably already disable auto-linking in their usage requirements." </p> <p> I checked. It works. So it`s going to be a serialization lib issue. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Mon, 06 Dec 2010 19:44:03 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4893#comment:6 https://svn.boost.org/trac10/ticket/4893#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> 1) It looks like your creating a DLL boost_serialization-vc90-mt-gd-1_45.dll with import library boost_serialization-vc90-mt-gd-1_45.lib but trying to link statically with it libboost_serialization-vc90-mt-gd-1_45.lib. This can never work and that's why the names are different - just to prevent this from being possible. </p> <p> 2) This is better, you're creating a static library libboost_serialization-vc90-sgd-1_45.lib as a single threaded library, but linking a main program compiled with multi-threaded code. That's why it's looking for with a libboost_serialization-vc90-mt-sgd-1_45.lib) This can work, but it also crash for no apparent reason. The auto link in preventing your from creating this type of problem. </p> <p> 3) This overrides all the checking above so your application might SEEM to work but can fail in a catestrophic and unpredictable way. </p> <p> Suggestion. Make sure your main program and the libraries are built with the same settings. </p> <p> I don't know why the other libraries worked - maybe the main program had different settings or maybe the library was built with different settings. I can't speak to that. </p> <p> Robert Ramey </p> Ticket