title: gcc - A static library with undefined symbols?
body: <p>I'm trying to build a project using a static library, so that the binary can be used even if the library isn't installed.  However, I get lots of errors about undefined symbols when I try to do so.</p>
  
  <p>Looking at the library, I see it has tons of undefined symbols, even though it's a <code>.a</code> static lib:</p>
  
  <pre><code>nm - u /usr/local/lib/libthis.a
  ....
  U EVP_DigestFinal_ex
  U EVP_DigestInit_ex
  U EVP_DigestUpdate
  U EVP_MD_CTX_cleanup
  U EVP_MD_CTX_init
  </code></pre>
  
  <p>Those seem to be from openssl; others seem to be from libbzip2; etc.</p>
  
  <p>Questions:
  1. Why does the static (<code>.a</code>) lib have dependencies on shared objects (e.g. libopenssl) that aren't statically compiled?
  2. How do I solve this? Trying to manually add <code>-lssl</code> doesn't seem to work.  How do I get the binary to compile and not have external dependcies?</p>