title: Problem linking Boost.Filesystem statically to a shared library
body: <p>I'm building a shared library with <code>GCC 4.5.2</code> and <code>Boost 1.46.1</code> (compiled with <code>--build-type=complete</code>) and this is a command from Makefile which does the linkage part:</p>
  
  <pre><code>$(CXX) -static -lboost_filesystem -fpic -shared $^ -o $@
  </code></pre>
  
  <p>Everything compiles fine but I get the following error when it gets loaded by application:</p>
  
  <pre><code>plugins/crashdetect.so: undefined symbol: _ZN5boost11filesystem34path21wchar_t_codecvt_facetEv
  </code></pre>
  
  <p><code>ldd</code>outputs:</p>
  
  <pre><code>linux-gate.so.1 =&gt;  (0x002f8000)
  libstdc++.so.6 =&gt; /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x00bf5000)
  libm.so.6 =&gt; /lib/i386-linux-gnu/libm.so.6 (0x0032d000)
  libc.so.6 =&gt; /lib/i386-linux-gnu/libc.so.6 (0x00506000)
  /lib/ld-linux.so.2 (0x006f6000)
  libgcc_s.so.1 =&gt; /lib/i386-linux-gnu/libgcc_s.so.1 (0x00110000)
  </code></pre>
  
  <p>I beleive this means that it linked Boost statically. </p>
  
  <p>This is what <code>nm crashdetect.so -u | grep boost</code> says:</p>
  
  <pre><code> U _ZN5boost11filesystem34path21wchar_t_codecvt_facetEv
   U _ZN5boost11filesystem36detail13dir_itr_closeERPvS3_
   U _ZN5boost11filesystem36detail28directory_iterator_constructERNS0_18directory_iteratorERKNS0_4pathEPNS_6system10error_codeE
   U _ZN5boost11filesystem36detail28directory_iterator_incrementERNS0_18directory_iteratorEPNS_6system10error_codeE
   U _ZN5boost11filesystem36detail6statusERKNS0_4pathEPNS_6system10error_codeE
   U _ZN5boost6system15system_categoryEv
   U _ZN5boost6system16generic_categoryEv
   U _ZNK5boost11filesystem315directory_entry12m_get_statusEPNS_6system10error_codeE
  </code></pre>
  
  <p>So I think since that symbol goes first in this list then most likely there's nothing special about it.</p>
  
  <p>Am I missing something?</p>
  
  <p><strong>EDIT:</strong>
  So is this impossible or what?</p>