Boost C++ Libraries: Ticket #7085: Boost pool library it not header only as claimed in documentation https://svn.boost.org/trac10/ticket/7085 <p> Hi, </p> <p> I have been trying to use the bool pool library out of the current release 1.50.0. The documentation page claims the library is header only, but it pulls in the threads library which is not header only. You can reproduce this with the code: </p> <p> #include &lt;boost/pool/pool_alloc.hpp&gt; </p> <p> int main () { </p> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> I get the following error on gnu 4.3.5 compilers: </p> <p> Linking CXX executable Panzer_roger_junk.exe CMakeFiles/Panzer_roger_junk.dir/roger.cpp.o: In function `<span class="underline">static_initialization_and_destruction_0': /home/rppawlo/install_boost_1_50_0/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()' /home/rppawlo/install_boost_1_50_0/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()' /home/rppawlo/install_boost_1_50_0/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()' collect2: ld returned 1 exit status </span></p> <p> The issue is that &lt;boost/pool/pool_alloc.hpp&gt; includes &lt;boost/pool/poolfwd.hpp&gt; which includes &lt;boost/pool/detail/mutex.hpp&gt; which includes &lt;boost/thread/mutex.hpp&gt; which includes &lt;boost/thread/pthread/mutex.hpp&gt; which includes &lt;boost/thread/exceptions.hpp&gt; </p> <p> The &lt;boost/thread/exceptions.hpp&gt; directly uses the boost system library which is not header only. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7085 Trac 1.4.3 SiliconKiwi Thu, 19 Jul 2012 04:00:23 GMT <link>https://svn.boost.org/trac10/ticket/7085#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:1</guid> <description> <p> Yep it pulls in boost::threads as well, even if BOOST_POOL_NO_MT is defined. </p> <p> Changing the include guard in pool/detail/mutex.hpp around &lt;boost/thread/mutex.hpp&gt; to this: </p> <p> #if defined (BOOST_HAS_THREADS) &amp;&amp; !defined(BOOST_POOL_NO_MT) </p> <p> fixes the problem, as long as BOOST_POOL_NO_MT is defined. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 20 Dec 2012 14:24:31 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7085#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:2</guid> <description> <p> tnx </p> </description> <category>Ticket</category> </item> <item> <dc:creator>dpantele</dc:creator> <pubDate>Thu, 28 Mar 2013 15:21:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7085#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:3</guid> <description> <p> Probably #if defined(BOOST_HAS_THREADS) &amp;&amp; !defined(BOOST_NO_MT) &amp;&amp; !defined(BOOST_POOL_NO_MT) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 09 Jan 2014 08:51:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7085#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:4</guid> <description> <p> Issue still present in 1.55. Proposed solution by dpantele looks correct and works as expected. </p> </description> <category>Ticket</category> </item> <item> <author>nico.schloemer@…</author> <pubDate>Fri, 16 May 2014 10:02:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7085#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:5</guid> <description> <p> This bug seems easy to fix, and is a cause for downstream bugs that are hard to debug (e.g., Sandia Trilinos bug 5929). Also, note that boost bug <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7335" title="#7335: Bugs: Using Boost.Pool requires to link with Boost.System (closed: duplicate)">#7335</a> is a duplicate of this. </p> <p> Getting the proposed fix in (which does the trick as far as I'm concerned) would be very helpful. </p> </description> <category>Ticket</category> </item> <item> <author>vz-xmlwrapp@…</author> <pubDate>Mon, 01 Sep 2014 15:41:14 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/7085#comment:6 https://svn.boost.org/trac10/ticket/7085#comment:6 <ul> <li><strong>cc</strong> <span class="trac-author">vz-xmlwrapp@…</span> added </li> </ul> Ticket anonymous Thu, 12 Feb 2015 18:46:59 GMT <link>https://svn.boost.org/trac10/ticket/7085#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:7</guid> <description> <p> Unfortunately, the proposed workaround causes a crash when used in a multithreaded application. For this reason, the proposed workaround is useless. Perhaps someone can put back in the light weight version of default_mutex? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 12 Feb 2015 18:48:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7085#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:7</guid> <description> <p> Unfortunately, the proposed workaround causes a crash when used in a multithreaded application. For this reason, the proposed workaround is useless. Perhaps someone can put back in the light weight version of default_mutex? </p> </description> <category>Ticket</category> </item> <item> <author>Will Wagner <willw@…></author> <pubDate>Mon, 16 Feb 2015 19:53:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7085#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:8</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/7085#comment:7" title="Comment 7">anonymous</a>: </p> <blockquote class="citation"> <p> Unfortunately, the proposed workaround causes a crash when used in a multithreaded application. For this reason, the proposed workaround is useless. Perhaps someone can put back in the light weight version of default_mutex? </p> </blockquote> <p> If you use boost/pool_alloc then it is up to you to provide thread synchronisation. Either that or use singlton_pool which deals wit this. </p> <p> This changes fixes this issue - how can we get someone to actually review this trivial change? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Laurie</dc:creator> <pubDate>Sat, 17 Jun 2017 06:55:25 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7085#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7085#comment:9</guid> <description> <p> So I just ran into this bug yesterday, and am a bit disheartened to discover it's been broken for 5 years... Is there any chance of a fix, or is this library no longer supported? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Michael Caisse</dc:creator> <pubDate>Wed, 19 Sep 2018 22:18:00 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7085#comment:10 https://svn.boost.org/trac10/ticket/7085#comment:10 <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> Resolved with 9def9a536f5bc69922065a875d27f8918afa76f5 </p> Ticket