title: Linking statically only boost library G++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2954387/can-i-mix-static-and-shared-object-libraries-when-linking">Can I mix static and shared-object libraries when linking?</a>  </p>
  </blockquote>
  
  
  
  <p>I want to compile my app, linking statically only boost_system library. Other(glibc and etc) should be linked dynamically. How can i do it?</p>
  
  <p>My command to compile dynamically:</p>
  
  <pre><code>g++  -o newserver  server.cpp ... -lboost_system -std=c++0x
  </code></pre>
  
  <p>Command to compile statically:</p>
  
  <pre><code>g++ -static  -o newserver  server.cpp ... -pthread -lboost_system -std=c++0x
  </code></pre>
  
  <p>But this command link statically all! And app weights 2mb more!</p>
  
  <p>Can you advice me what command to compile statically only boost lib?</p>
  
  <p>Thanks!</p>