title: Fully statically build application with all dependencies (libgcc, etc.)?
body: <p>I am currently trying to <strong>compile all my applications' dependencies as a static library</strong>. My motivation:</p>
  
  <ol>
  <li>Not to rely on any OS provided libraries in order to have a perfectly reproducible code base</li>
  <li>Avoid issues when deploying on other systems caused by dynamic linking</li>
  <li>Avoid run-time clashes when linking against different versions of a library</li>
  <li>Being able to cross-compile for other OS</li>
  </ol>
  
  <p>However, as I initially dreaded I had to go down the rabbit hole quite fast. I am currently stuck with OpenCV and I'm sure there is more to come. However, <strong>my main questions</strong> are:</p>
  
  <ol>
  <li>Is it possible to build an entirely statically build app (e.g. libc, ligcc, etc. ?)</li>
  <li>Is it possible to link all libraries statically but link major components (libgcc, etc.) dynamically?</li>
  <li>If not, is it possible to link against statically built libraries (e.g. OpenCV) but to satisfy their dependencies by linking dynamically (zlib, libc, etc.)?</li>
  <li>I did research on the internet but couldn't find a comprehensive guide that dwells on the internals of linking (static vs. dynamic). Do you know about a good book / tutorial? Does a book about gcc get me further?</li>
  <li>Is this a very stupid idea?</li>
  </ol>