Boost C++ Libraries: Ticket #11544: Error: Linker scopes may not change after symbol definition. https://svn.boost.org/trac10/ticket/11544 <p> I compiled Boost 1.59.0 with Solaris Studio 12.4 in C++11 mode and I get the following error messages: </p> <p> "./boost/regex/v4/instances.hpp", line 172: Error: Linker scopes may not change after symbol definition. "./boost/regex/v4/instances.hpp", line 174: Error: Linker scopes may not change after symbol definition. "libs/serialization/src/basic_archive.cpp", line 45: Error: Linker scopes may only be more restrictive. "libs/serialization/src/basic_archive.cpp", line 79: Error: Linker scopes may only be more restrictive. "libs/serialization/src/basic_xml_archive.cpp", line 18: Error: Linker scopes may only be more restrictive. "libs/serialization/src/basic_xml_archive.cpp", line 22: Error: Linker scopes may only be more restrictive. "libs/serialization/src/void_cast.cpp", line 315: Error: Linker scopes may only be more restrictive. "libs/serialization/src/void_cast.cpp", line 349: Error: Linker scopes may only be more restrictive. </p> <p> dmr195 on stackoverflow.com suggested the temporary fix of removing the following lines in boost/config/compiler/sunpro_cc.hpp: </p> <p> <em> </em> Dynamic shared object (DSO) and dynamic-link library (DLL) support <em> #if <span class="underline">SUNPRO_CC &gt; 0x500 # define BOOST_SYMBOL_EXPORT </span>global # define BOOST_SYMBOL_IMPORT <span class="underline">global # define BOOST_SYMBOL_VISIBLE </span>global #endif </em></p> <p> For now I agree with him that everything works even without symbol scoping. It just means that the linker has to deal with a lot more symbols than it needs to. </p> <p> According to the Solaris Studio 12.4 C++ User's Guide, to achieve linker scoping equivalent to Visual Studio's scoping the compiler option -xldscope=hidden must be used in combination with the following: </p> <p> <span class="underline">symbolic (equivalent to </span>declspec(dllexport)) <span class="underline">global (equivalent to </span>declspec(dllimport)) </p> <p> The above user's guide also specifically warned to use <span class="underline">global only on symbol declarations, not symbol definitions. </span></p> <p> This warning is most likely the reason why the errors in regex are happening. </p> <p> BTW, I tried simply changing <span class="underline">global to </span>symbolic in the definition of BOOST_SYMBOL_EXPORT without any luck. This may mean that either BOOST_SYMBOL_EXPORT or BOOST_SYMBOL_IMPORT is not used correctly. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11544 Trac 1.4.3 John Maddock Tue, 18 Aug 2015 11:23:46 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11544#comment:1 https://svn.boost.org/trac10/ticket/11544#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">fixed</span> </li> </ul> <p> I fixed this slightly differently in <a class="ext-link" href="https://github.com/boostorg/regex/commit/b9ee7a2f2ee07ff46af9f9339f4a155c2a9c5992"><span class="icon">​</span>https://github.com/boostorg/regex/commit/b9ee7a2f2ee07ff46af9f9339f4a155c2a9c5992</a>, I'll try to find a better fix later. </p> Ticket lcarreon@… Tue, 18 Aug 2015 23:09:32 GMT <link>https://svn.boost.org/trac10/ticket/11544#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11544#comment:2</guid> <description> <p> This ticket has been closed based on a fix to regex. What about serialization? Should I raise a separate ticket for it? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 19 Aug 2015 17:22:26 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11544#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11544#comment:3</guid> <description> <p> This patch is also required for Oracle C++: <a class="ext-link" href="https://github.com/boostorg/regex/commit/5e98fe9a6ababcc640cfcf0a76685f7ac70384f3"><span class="icon">​</span>https://github.com/boostorg/regex/commit/5e98fe9a6ababcc640cfcf0a76685f7ac70384f3</a> </p> <blockquote class="citation"> <p> This ticket has been closed based on a fix to regex. What about serialization? Should I raise a separate ticket for it? </p> </blockquote> <p> Yes please: one ticket per library always works best. </p> </description> <category>Ticket</category> </item> </channel> </rss>