Boost C++ Libraries: Ticket #11784: basic_xml_grammar.hpp https://svn.boost.org/trac10/ticket/11784 <p> After upgrading to 1.59 I get the following linker error when I try to use xml_iarchive </p> <p> ../../util/libutil.a(saveload.o): In function `boost::archive::xml_iarchive_impl&lt;boost::archive::xml_iarchive&gt;::xml_iarchive_impl(std::istream&amp;, unsigned int)': /(_location of local boost_)/boost/include/boost/archive/impl/xml_iarchive_impl.ipp:175: undefined reference to `boost::archive::basic_xml_grammar&lt;char&gt;::basic_xml_grammar() </p> <p> After inspection of the source code of the library I kind of agree with the linker -- I cannot find which file contains the definition of the constructor (same applies for all other member functions of basic_xml_grammar). I do not pretend that I understand the inner workings of the serialization library, but this broke code which used to work with release 1.53.0, so something has changed. </p> <p> Do you mind either pointing to me where to find the implementation of basic_xml_grammar in the source code distribution (in which case I will take care of finding out what went wrong with the linker locating the code) or if the implementation is really missing then providing it (if that were the case could you provide it before the next release -- I would like to not wait till then). </p> <p> Thank you. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11784 Trac 1.4.3 Robert Ramey Wed, 04 Nov 2015 22:00:05 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11784#comment:1 https://svn.boost.org/trac10/ticket/11784#comment:1 <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> look in src directory. You'll find xml_iarchive.cpp which refers functions in xml_grammer.cpp. This file in turn explicitly instantiates basic_xml_grammar&lt;char&gt;. </p> Ticket epsilonomega2k@… Thu, 05 Nov 2015 23:52:24 GMT <link>https://svn.boost.org/trac10/ticket/11784#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11784#comment:2</guid> <description> <p> This actually is a subtle problem on my platform and by extension I expect it to be a problem for some other people, so here are the details: </p> <p> The compiler/linker does not make the symbols created by the instantiation of basic_xml_grammar&lt;char&gt; inside xml_grammar.cpp available in libboost_serialization.so.1.59.0. They are available in libboost_serialization.a, so static linking is unaffected. I observed this by running nm -g -C on both libraries. </p> <p> To correct the problem for my local copy I just placed </p> <div class="wiki-code"><div class="code"><pre><span class="n">__attribute__</span> <span class="p">((</span><span class="n">visibility</span> <span class="p">(</span><span class="s">&quot;default&quot;</span><span class="p">)))</span> </pre></div></div><p> in the definitions of the member functions of basic_xml_grammar inside basic_xml_grammar.ipp . This forces the symbols to be placed inside the dynamic shared object library in the case of g++ (I am using g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4). </p> <p> I am not versed enough in compilers, pragmas and such to recommend a solution in the generic case, but I suggest that someone at least manually check that these dynamic libraries export the symbols for the members of basic_xml_grammar&lt;char&gt; when the compilation is made with the latest versions of g++. One does not run into this problem until one tries link versus the dynamic libraries and I am not certain that anyone ever tested this before making the release, especially if this happens only on some compilers and not others. </p> </description> <category>Ticket</category> </item> <item> <author>tom.dreyfus@…</author> <pubDate>Fri, 21 Oct 2016 14:27:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11784#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11784#comment:3</guid> <description> <p> Hello, </p> <p> I faced a similar issue and I noticed the same problem with libboost_serialization.so and libboost_serialization.a . </p> <p> My context is that I need to make a custom xml archive with the possibility to split the archive into two different archives (one containing the main data structure, and another one listing some heavy data structures containing in the main one). For my output archive, the boost tutorial worked fine. However, for my input archive, it did not work, and I found this ticket very similar to my troubles. </p> <p> I do not want to modify the boost library since I am coding in the context of a template C++ library, and I cannot use the solution proposed by epsilonomega2k. I found another workaround by adding to the headers of my library the following source files found in boost/libs/serialization/src : </p> <p> basic_xml_grammar.ipp xml_grammar.cpp -&gt; xml_grammar.ipp </p> <p> It compiles on my workstation, but this does not seem to be the right way to do. Do you have any suggestion ? </p> <p> Thank you. </p> <p> Tom. </p> </description> <category>Ticket</category> </item> </channel> </rss>