Install openssl-1.0.2l on OSX El Capitan and update Python's _ssl.so

A record of installing openssl-1.0.2l on OSX El Capitan.

The content is the same as Install openssl-1.0.2f on OSX Yosemite and update _ssl.so in Python.

OSX El Capitan's OpenSSL is 0.9.8 series, but support ended on December 31, 2015. OS X El Capitan will be released on September 30, 2015, and what about bundling OpenSSL 0.9.8zh, which will be EOL at the end of the year?

By the way, OS X El Capitan's openssl is for the version command

$ /usr/bin/openssl version
OpenSSL 0.9.8zh 14 Jan 2016

Returns the output. The distributed OpenSSL 0.9.8zh returns the output ʻOpenSSL 0.9.8zh 14 Jan 2016`, so it seems that something has been done.

build openssl-1.0.2l

Build the 32bit version and the 64bit version separately and make it Univesal Binary with lipo. I wondered if I could make it multilib with -arch x86_64 -xarch i386 with the compile option, but I'm taking this method because the compile will bring up a file.

$ ./Configure shared darwin64-x86_64-cc
$ make

test

$ make test

OK if there are no errors

Installation Installed in the default / usr / local / ssl.

$ sudo make install
$ cd /usr/local/ssl
$ sudo mkdir bin64
$ sudo sh -c 'cd bin && find . -print | cpio -pdmu ../bin64'
$ sudo mkdir lib64
$ sudo sh -c 'cd lib && find . -print | cpio -pdmu ../lib64'

Go back to the source tree and build the 32bit version

$ make clean
$ ./Configure shared darwin-i386-cc
$ make

Installation No documentation is needed, so run make install_sw.

$ sudo make install_sw
$ cd /usr/local/ssl
$ sudo mkdir bin32
$ sudo sh -c 'cd bin && find . -print | cpio -pdmu ../bin32'
$ sudo mkdir lib32
$ sudo sh -c 'cd lib && find . -print | cpio -pdmu ../lib32'

Create a Univesal Binary with lipo.

$ cd /usr/local/ssl
$ sudo lipo -create bin{32,64}/openssl -output bin/openssl
$ sudo lipo -create lib{32,64}/libcrypto.a -output lib/libcrypto.a
$ sudo lipo -create lib{32,64}/libssl.a -output lib/libssl.a
 $ find lib64 -type f -name '*.dylib' | while read file ; do echo lipo -create $(echo "$file" | sed 's/64/{32,64}/') -output $(echo "$file" | sed 's/64//'); done | sudo sh
$ sudo rm -r bin{32,64} lib{32,64}

If you use openssl in / usr / local / ssl when building programs in the future, 1.0.2 series openssl will be linked.

Update the python SSL library. Note that if the development environment is not xcode-select --install, configure will not find the header and an error will occur.

$ sudo xcode-select --install
Password:
xcode-select: note: install requested for command line developer tools

Get the source file from https://www.python.org/downloads/release/python-2710/.

tar xfz Python-2.7.10.tgz
cd Python-2.7.10
CC=cc \
CPPFLAGS=-I/usr/local/ssl/include \
LDFLAGS='-L/usr/local/ssl/lib -Wl,-rpath,/usr/local/ssl/lib' \
./configure --enable-framework --enable-universalsdk --with-universal-archs=intel
$ make

In fact, all I want is _ssl.so.

$ find . -name _ssl.so
./build/lib.macosx-10.5-intel-2.7/_ssl.so

This _ssl.so should be loaded when you do ʻimport ssl` in python.

$ sudo mkdir /Library/Python/2.7/lib-dynload
$ sudo cp build/lib.macosx-10.5-intel-2.7/_ssl.so /Library/Python/2.7/lib-dynload

Create a sitecustomize.py like this and add /Library/Python/2.7/lib-dynload to your search path.

/Library/Python/2.7/site-packages/sitecustomize.py


import sys
sys.path.insert(0, '/Library/Python/2.7/lib-dynload')

Operation check.

$ python
>>> import ssl
>>> ssl.OPENSSL_VERSION
'OpenSSL 1.0.2l  25 May 2017'

Recommended Posts

Install openssl-1.0.2l on OSX El Capitan and update Python's _ssl.so
Install python3 on Mac (El Capitan)
Install matplotlib on OS X El Capitan
Install pyenv on OSX
Install Caffe on OSX 10.10 and classify images by reference model
Install pillow on Mac OSX 10.9
How to make a .dylib library from a .a library on OSX (El Capitan)
Install Mecab and mecab-python3 on Ubuntu 14.04
Install and run dropbox on Ubuntu 20.04
Install OpenCV and Chainer on Ubuntu
Install CUDA 8.0 and Chainer on Ubuntu 16.04
Build and install OpenCV on Windows
Install fabric on Ubuntu and try
Install easy_install and pip on windows
Install wsl2 and master linux on windows
Install and launch k3s on Manjaro Linux
Install and Configure TigerVNC server on Linux
Install Puppet Master and Client on Ubuntu 16.04
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
Upgrading Python module in OSX El Capitan
Install pyenv and rbenv on CentOS system-wide