title: g++: Static linking not working
body: <p>I'm trying to link the standard library in my project statically. I've tried several variations of static link options from various threads on SO and other sites (<a href="http://www.trilithium.com/johan/2005/06/static-libstdc/" rel="nofollow">http://www.trilithium.com/johan/2005/06/static-libstdc/</a>), but none of them have yielded the desired results.</p>
  
  <p>Here's my current flag setup:</p>
  
  <pre><code>g++ -Wall -g -static-libgcc -static-libstdc++ -Iinclude -std=c++11
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>g++ -Wall -g -Wl,-Bstatic -lstdc++ -std=c++11
  </code></pre>
  
  <p>With either of these variations, the output of <code>ldd</code> still is:</p>
  
  <pre><code>linux-gate.so.1 =&gt; (0xb77b1000)
  libstdc++.so.6 =&gt; /lib/libstdc++.so.6 (0x4e085000)
  libm.so.6 =&gt; /lib/libm.so.6 (0x4daf0000)
  libgcc_s.so.1 -&gt; /lib/libgcc_s.s0.1 (0x4dd1f000)
  libc.so.6 =&gt; /lib/libc.so.6 (0x4d90a000)
  /lib/ld-linux.so.2 (0x4d8e7000)
  </code></pre>
  
  <p>Running <code>file</code> also tells me that it's a dynamically linked binary. I've tried this on multiple distros, including Fedora 18, Ubuntu 12.04, and CentOS, but to no avail.</p>