id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 9054,filesystem::path::codecvt() segfault pre-main with static filesystem,lukester_null@…,Beman Dawes,"Hi 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 &). Simple test case: {{{ #include ""boost/filesystem.hpp"" static const boost::filesystem::path::codecvt_type &dummy = boost::filesystem::path::codecvt(); int main() { return 0; } }}} Compiled with: g++ Main.cpp -o Test -lboost_filesystem -lboost_system -L/path/to/static/libs/only -I/path/to/boost -g Yields: {{{ (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 , __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 , argc=1, ubp_av=0x7fffffffd6d8, init=0x407830 <__libc_csu_init>, fini=, rtld_fini=, stack_end=0x7fffffffd6c8) at libc-start.c:217 #8 0x00000000004018fd in _start () }}} Move the dummy into main() and all is well. (The actual code isn't trying to call codecvt directly; it's creating a path from a G++ vstring.) Thanks Luke Elliott. ",Bugs,closed,Boost 1.56.0,filesystem,Boost 1.54.0,Problem,fixed,,