Boost C++ Libraries: Ticket #9054: filesystem::path::codecvt() segfault pre-main with static filesystem https://svn.boost.org/trac10/ticket/9054 <p> Hi </p> <p> Should boost::filesystem::path::codecvt() work pre-main when using static builds of the library? I'm getting a NULL std::locale::_M_impl in std::locale::locale(const std::locale &amp;). </p> <p> Simple test case: </p> <pre class="wiki">#include "boost/filesystem.hpp" static const boost::filesystem::path::codecvt_type &amp;dummy = boost::filesystem::path::codecvt(); int main() { return 0; } </pre><p> Compiled with: </p> <p> g++ Main.cpp -o Test -lboost_filesystem -lboost_system -L/path/to/static/libs/only -I/path/to/boost -g </p> <p> Yields: </p> <pre class="wiki">(gdb) bt #0 __atomic_add_dispatch (__val=1, __mem=0x0) at /usr/src/debug/gcc-4.8.1-20130603/obj-x86_64-redhat-linux/x86_64-redhat-linux/libstdc++-v3/include/ext/atomicity.h:96 #1 _M_add_reference (this=0x0) at /usr/src/debug/gcc-4.8.1-20130603/obj-x86_64-redhat-linux/x86_64-redhat-linux/libstdc++-v3/include/bits/locale_classes.h:510 #2 std::locale::locale ( this=0x609630 &lt;boost::filesystem::path::codecvt()::posix_lazy_initialization&gt;, __other=...) at ../../../../../libstdc++-v3/src/c++98/locale.cc:80 #3 0x00000000004023dc in boost::filesystem::path::codecvt() () #4 0x0000000000401a2f in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at Main.cpp:3 #5 0x0000000000401a4b in _GLOBAL__sub_I_main () at Main.cpp:8 #6 0x000000000040787d in __libc_csu_init () #7 0x0000003f09a21b05 in __libc_start_main (main=0x4019c0 &lt;main()&gt;, argc=1, ubp_av=0x7fffffffd6d8, init=0x407830 &lt;__libc_csu_init&gt;, fini=&lt;optimized out&gt;, rtld_fini=&lt;optimized out&gt;, stack_end=0x7fffffffd6c8) at libc-start.c:217 #8 0x00000000004018fd in _start () </pre><p> Move the dummy into main() and all is well. </p> <p> (The actual code isn't trying to call codecvt directly; it's creating a path from a G++ vstring.) </p> <p> Thanks </p> <p> Luke Elliott. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9054 Trac 1.4.3 anonymous Wed, 28 Aug 2013 10:57:37 GMT <link>https://svn.boost.org/trac10/ticket/9054#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9054#comment:1</guid> <description> <p> Sorry, forgot to say (though it's somewhat implicit from the callstack) - Fedora 19, GCC 4.8. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 11 Jul 2014 16:29:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9054#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9054#comment:2</guid> <description> <p> What with this bug? It can not be fixed? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 14 Jul 2014 08:56:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9054#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9054#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9054#comment:2" title="Comment 2">anonymous</a>: </p> <blockquote class="citation"> <p> What with this bug? It can not be fixed? </p> </blockquote> <p> Problem may occure while using openvz conteiner </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Mon, 04 Aug 2014 15:43:33 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/9054#comment:4 https://svn.boost.org/trac10/ticket/9054#comment:4 <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> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.56.0</span> </li> </ul> <p> Fixed 2c0d73967d70409a58a6b700210a2f474926ecfd </p> <p> Test program supplied was run on Linux/gcc against: </p> <blockquote> <p> 1.54.0 (failed) 1.55.0 (failed) 1.56.0 RC2 (passed) </p> </blockquote> <p> Thanks, </p> <p> --Beman </p> Ticket