title: Build OpenSSL with RPATH?
body: <p>I have Ubuntu 14.04. It came with openssl 1.0.1f. I want to install another openssl version (1.0.2) and I want to compile it by myself. </p>
  
  <p>I configure it as follows:</p>
  
  <pre class="lang-none prettyprint-override"><code>LDFLAGS='-Wl,--export-dynamic -L/home/myhome/programs/openssl/i/lib 
  -L/home/myhome/programs/zlib/i/lib'
  
  CPPFLAGS='-I/home/myhome/programs/openssl/i/include 
  -I/home/myhome/programs/zlib/i/include'
  
  ./config --prefix=/home/myhome/programs/openssl/i \
  zlib-dynamic shared --with-zlib-lib=/home/myhome/programs/zlib/i/lib \
  --with-zlib-include=/home/myhome/programs/zlib/i/include
  
  make 
  
  make install
  </code></pre>
  
  <p>After install, when i check the binary with <code>ldd openssl</code>, and the result is:</p>
  
  <pre class="lang-none prettyprint-override"><code>...
  libssl.so.1.0.0 =&gt; /home/myhome/programs/openssl/i/lib/libssl.so.1.0.0 (0x00007f91138c0000)
  libcrypto.so.1.0.0 =&gt; /home/myhome/programs/openssl/i/lib/libcrypto.so.1.0.0 (0x00007f9113479000)
  ...
  </code></pre>
  
  <p>which looks fine. But when I check ldd <code>libssl.so</code>, the result is:</p>
  
  <pre class="lang-none prettyprint-override"><code>...
  libcrypto.so.1.0.0 =&gt; /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fac70930000)
  ...
  </code></pre>
  
  <p>It still uses the system version  of libcrypto. I tried different ways to 
  build, but result is always stays the same.</p>
  
  <p>My question is how to configure the build in a way, that it can hardcode all binary and library dependencies of shared libraries without using <code>LD_LIBRARY_PATH</code>, or anything like that. </p>