Boost C++ Libraries: Ticket #2181: Boost build issue on Windows/MinGW https://svn.boost.org/trac10/ticket/2181 <p> bjam link=static --toolset=gcc </p> <p> If I build boost static libraries on windows with the intention of using them with the GCC toolset, the resulting libraries are created with a .lib extension: </p> <p> libboost_date_time-mgw34-mt-1_35.lib libboost_filesystem-mgw34-mt-1_35.lib libboost_graph-mgw34-mt-1_35.lib libboost_iostreams-mgw34-mt-1_35.lib libboost_prg_exec_monitor-mgw34-mt-1_35.lib libboost_program_options-mgw34-mt-1_35.lib libboost_regex-mgw34-mt-1_35.lib libboost_serialization-mgw34-mt-1_35.lib libboost_signals-mgw34-mt-1_35.lib libboost_system-mgw34-mt-1_35.lib libboost_test_exec_monitor-mgw34-mt-1_35.lib libboost_thread-mgw34-mt-1_35.lib libboost_unit_test_framework-mgw34-mt-1_35.lib libboost_wave-mgw34-mt-1_35.lib </p> <p> Subsequently, after compiling my code using these libraries, I get a run-time error saying the relevant DLL wasn't found. </p> <p> However, if I rename all of the boost libraries from .lib files to .a files and compile again, the run-time errors go away and the program runs fine. The executable size increases approximately by the size of the static library too. </p> <p> I feel the solution to this problem is to have BJAM generate the set of static libraries with an extension of .a instead of .lib under windows if the GCC toolset was specified. </p> <p> ie: </p> <p> bjam link=static --toolset=gcc </p> <p> should result in the following files on Windows: </p> <p> libboost_date_time-mgw34-mt-1_35.a libboost_filesystem-mgw34-mt-1_35.a libboost_graph-mgw34-mt-1_35.a libboost_iostreams-mgw34-mt-1_35.a libboost_prg_exec_monitor-mgw34-mt-1_35.a libboost_program_options-mgw34-mt-1_35.a libboost_regex-mgw34-mt-1_35.a libboost_serialization-mgw34-mt-1_35.a libboost_signals-mgw34-mt-1_35.a libboost_system-mgw34-mt-1_35.a libboost_test_exec_monitor-mgw34-mt-1_35.a libboost_thread-mgw34-mt-1_35.a libboost_unit_test_framework-mgw34-mt-1_35.a libboost_wave-mgw34-mt-1_35.a </p> <p> Regards Tristen </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2181 Trac 1.4.3 Steven Watanabe Thu, 04 Dec 2008 03:12:03 GMT component changed; owner set https://svn.boost.org/trac10/ticket/2181#comment:1 https://svn.boost.org/trac10/ticket/2181#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Vladimir Prus</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">build</span> </li> </ul> Ticket Vladimir Prus Thu, 04 Dec 2008 07:41:38 GMT <link>https://svn.boost.org/trac10/ticket/2181#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2181#comment:2</guid> <description> <p> I don't understand your "I get a run-time error saying the relevant DLL wasn't found." statement. What is "relevant DLL" and how any DLL can be relevant when doing static linking and that is the actual error. </p> </description> <category>Ticket</category> </item> <item> <author>tristen_e@…</author> <pubDate>Mon, 02 Mar 2009 02:42:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2181#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2181#comment:3</guid> <description> <p> Hi Vlad, </p> <p> Sorry to take so long in responding - I only just found the email. </p> <p> To answer your question: I'm as confused as you. I politely asked GCC to link statically to the boost libs; linking completes successfully (ie: with no errors); it's only at run-time that the executable complains rather rudely about not being able to find the boost dlls. </p> <p> Since I typed the issue in all those months ago I think the problem is more related to the fact that I'm using MinGW in a Cygwin environment. Hence maybe that's why the linker in my environment is treating .lib files as if they were .dll files. </p> <p> So whatever the reason, renaming the .lib files to .a files works, ie: the compiler/linker makes an executable statically linked using the .a files. </p> <p> And finally, if my suspicions are correct, then this isn't a problem at all, ie: how can bjam know if my intentions are to use the Windows boost libraries from Cygwin, unless of course you guys are willing to add a --toolset=mingw-via-cygwin flag to bjam ;) </p> <p> No I wouldn't either :) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Tue, 10 Nov 2009 07:53:59 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/2181#comment:4 https://svn.boost.org/trac10/ticket/2181#comment:4 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.36.0</span> → <span class="trac-field-new">Boost 1.42.0</span> </li> </ul> <p> Should be done with other mingw fixups for 1.42 </p> Ticket Vladimir Prus Mon, 01 Mar 2010 22:32:21 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2181#comment:5 https://svn.boost.org/trac10/ticket/2181#comment:5 <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">fixed</span> </li> </ul> <p> Actually fixed now. </p> Ticket