Boost C++ Libraries: Ticket #13476: Linker error when using Spirit Classic https://svn.boost.org/trac10/ticket/13476 <p> After upgrading to Boost 1.60, my project using Spirit Classic no longer builds, failing with a linker error complaining about undefined references to boost::system::generic_category() and boost::system::system_category(). </p> <p> The minimal test case is: </p> <pre class="wiki">#include &lt;boost/spirit/include/classic.hpp&gt; int main (int argc, char ** argv) { return 0; } </pre><p> which gives results in the following compiler output: </p> <pre class="wiki">$ g++ -Wall test.cxx /tmp/ccpjbwj6.o: In function `__static_initialization_and_destruction_0(int, int)': test.cxx:(.text+0x23f): undefined reference to `boost::system::generic_category()' test.cxx:(.text+0x249): undefined reference to `boost::system::generic_category()' test.cxx:(.text+0x253): undefined reference to `boost::system::system_category()' collect2: error: ld returned 1 exit status </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13476 Trac 1.4.3 janis.ruksans@… Tue, 13 Mar 2018 00:38:31 GMT <link>https://svn.boost.org/trac10/ticket/13476#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13476#comment:1</guid> <description> <p> A workaround is to define BOOST_SYSTEM_NO_DEPRECATED before including any Spirit headers. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Tue, 13 Mar 2018 01:57:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13476#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13476#comment:2</guid> <description> <p> I don't think this is a Spirit bug. Is boost::system advertised to be header only? </p> </description> <category>Ticket</category> </item> <item> <author>janis.ruksans@…</author> <pubDate>Tue, 13 Mar 2018 03:28:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13476#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13476#comment:3</guid> <description> <p> Boost.System isn't, but Spirit is, right? At least it is not listed among the libraries that are not header only <a href="http://www.boost.org/doc/libs/1_60_0/more/getting_started/unix-variants.html#header-only-libraries">here</a>. </p> </description> <category>Ticket</category> </item> <item> <author>Nikita Kniazev <nok.raven@…></author> <pubDate>Wed, 14 Mar 2018 16:13:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13476#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13476#comment:4</guid> <description> <p> The first thing I should say: Boost 1.60 is pretty old (released 2+ years ago). </p> <p> Spirit does not use Boost.System directly, but I suspect it is used by Boost.Thread that may be included even if <code>BOOST_SPIRIT_THREADSAFE</code> is not defined. Please try to apply manually <a class="ext-link" href="https://github.com/boostorg/spirit/pull/323.patch"><span class="icon">​</span>https://github.com/boostorg/spirit/pull/323.patch</a> or better grab the latest Spirit from the git develop branch. </p> <p> The simplest solution for you is to add <code>-lboost_system</code> to you compile command. </p> </description> <category>Ticket</category> </item> <item> <author>Nikita Kniazev <nok.raven@…></author> <pubDate>Wed, 14 Mar 2018 16:22:09 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/13476 https://svn.boost.org/trac10/ticket/13476 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">thread_unsafe.patch</span> </li> </ul> Ticket Nikita Kniazev <nok.raven@…> Wed, 14 Mar 2018 16:23:53 GMT <link>https://svn.boost.org/trac10/ticket/13476#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13476#comment:5</guid> <description> <p> The <code>boost/spirit/home/classic/core/non_terminal/impl/static.hpp</code> might still be a problem even on the latest Spirit. Try to also apply the attached patch <a class="ext-link" href="https://svn.boost.org/trac10/attachment/ticket/13476/thread_unsafe.patch"><span class="icon">​</span>`thread_unsafe.patch​`</a>. </p> </description> <category>Ticket</category> </item> <item> <author>Nikita Kniazev <nok.raven@…></author> <pubDate>Fri, 16 Mar 2018 17:26:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13476#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13476#comment:6</guid> <description> <p> Oh, I missed that <code>boost/spirit/home/classic/core/non_terminal/impl/static.hpp</code> will be included only if <code>BOOST_SPIRIT_THREADSAFE</code> is defined. So the problem should have been fixed in <a class="ext-link" href="https://github.com/boostorg/spirit/pull/323"><span class="icon">​</span>PR 323</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Thu, 22 Nov 2018 13:51:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/13476#comment:7 https://svn.boost.org/trac10/ticket/13476#comment:7 <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> Ticket