title: Compiling Python 2.7.12 with non-system Openssl on Centos 5
body: <p>I'm currently trying to get Python 2.7.12 to compile with Openssl 1.0.2h on a Centos 5 host.</p>
  
  <p>The reason for this is that I need Paramiko 2 to run on this host but that doesn't support the system provided OpenSSL version which is 0.9.8e-fips-rhel5 01 Jul 2008.</p>
  
  <p>I've found some great hints and tips on here but it just doesn't seem to work. I'm now posting this in hope that someone will spot what I've done wrong/is missing.</p>
  
  <p>For the OpenSSL setup I've done the following:</p>
  
  <pre><code>OPENSSL_ROOT="$HOME/.build/openssl-1.0.1e"
  cd /tmp
  curl http://www.openssl.org/source/openssl-1.0.2h.tar.gz | tar zxvf -
  cd openssl-1.0.2.h
  mkdir -p "$OPENSSL_ROOT"
  ./config no-hw --prefix="$OPENSSL_ROOT" --openssldir=...
  make install
  </code></pre>
  
  <p>Then since I don't want to replace the system installed Python with 2.7.12 I've done the following:</p>
  
  <p>First I added /usr/local/lib to /etc/ld.so.conf and ran ldconfig.</p>
  
  <p>After that I've run:</p>
  
  <pre><code>cd /tmp
  wget http://python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
  tar xf Python-2.7.12.tar.xz
  cd Python-2.7.12
  ./configure CPPFLAGS="-I$OPENSSL_ROOT/include"  LDFLAGS="-L$OPENSSL_ROOT/lib"  --prefix=/usr/local --enable-unicode=ucs4 --enable-shared
  make &amp;&amp; make altinstall
  </code></pre>
  
  <p>This is when I thought I'd have it compiled against the new version of OpenSSL but no, as you can see from the output here:</p>
  
  <pre><code>[root@an-host openssl-1.0.2h]# python2.7 -c "import ssl; print ssl.OPENSSL_VERSION"
  OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
  </code></pre>
  
  <p>And I'm sure that I'm running the newly compiled version since that is echoed here:</p>
  
  <pre><code>[root@an-host openssl-1.0.2h]# python2.7
  Python 2.7.12 (default, Aug  1 2016, 11:46:42) 
  [GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  </code></pre>
  
  <p>I have even gone as far as removing openssl-devel with Yum but it still doesn't seem to care/compile against 1.0.2h.</p>
  
  <p>This is driving me slightly mad at the moment so any input/feedback/help is greatly appreciated.</p>