title: Linking OpenSSL libraries to a program
body: <p>I have built OpenSSL from source (an intentionally old version; built with <code>./config &amp;&amp; make &amp;&amp; make test</code>) and would prefer to use what I have built without doing <code>make install</code> to link against my program.</p>
  
  <p>The command that's failing is:</p>
  
  <pre><code>gcc -Wall -Wextra -Werror -static -Lopenssl/openssl-0.9.8k/ -lssl -lcrypto 
  -Iopenssl/openssl-0.9.8k/include -o myApp source1.o source2.o common.o`
  </code></pre>
  
  <p>And I receive a series of errors similar to:</p>
  
  <pre><code>common.c:(.text+0x1ea): undefined reference to `SSL_write'
  </code></pre>
  
  <p>This makes me think there's something funky with my OpenSSL.  If I omit <code>-Lopenssl/openssl-0.9.8k/</code> from my command, the error changes to being unable to:</p>
  
  <pre><code>/usr/bin/ld: cannot find -lssl
  /usr/bin/ld: cannot find -lcrypto
  </code></pre>
  
  <p>Am I compiling OpenSSL incorrectly?  Or how should I best resolve this?</p>