![]() configure -prefix=/Users/patrick/project/python \ > CFLAGS="-I$(brew -prefix gdbm)/include -I$(brew -prefix xz)/include" \ Now, you need to update the configure command to point to the compiled OpenSSL from the previous setup, instead of the Homebrew installed one: ![]() However, combining information found in a message on the Python bug tracker, and a StackOverflow answer, I was able to piece together the following contents for my Modules/Setup.local file (this is back in the Python source code directory, trying to compile version 3.9.x in my case). However, I was unable to find much documentation about how you’re supposed to use it. I came across a few references to it while searching. The Python build system looks for a Modules/Setup.local file to allow for some customization of the build. With OpenSSL built, it’s now time to re-compile Python but statically linked to OpenSSL this time. openssldir=/Users/patrick/project/openssl I wanted OpenSSL 1.1.1, so I cloned the repo and checked out the latest 1.1.1 tag ( OpenSSL_1_1_1s at the time of writing), and ran the following The first step is to compile the version of OpenSSL you want to link to. (Someone tried to get a PR accepted, but it was eventually closed without being merged.)īut while it’s not officially supported, there are a few ways to do it. It turns out that this is not something officially supported by Python. So I set off looking for the instructions for how to statically link OpenSSL with our compiled Python. We didn’t want to create a dependency on the destination machine having a specific version of a Homebrew-installed OpenSSL available. ![]() The problem was that pip was trying to import the ssl module, and on some of the machines the version of OpenSSL I had installed (using Homebrew) on my development machine, was not available. It worked perfectly on some, but on others, it would fail during a step that was trying to use pip to install dependencies. configure -prefix=/Users/patrick/project/python -with-pydebug \Īfter running configure, just make and install:Įverything was looking good until we did some testing on other machines. To do that I specified a -prefix= argument: That way, I could zip it up and bundle it with the application I was packaging. I didn’t want to install this Python on my local system but rather install it into a known directory. with-tcltk-includes="$(pkg-config -cflags tcl tk)" ![]() with-tcltk-libs="$(pkg-config -libs tcl tk)" \ PKG_CONFIG_PATH="$(brew -prefix tcl-tk)/lib/pkgconfig" \ LDFLAGS="-L$(brew -prefix gdbm)/lib -L$(brew -prefix xz)/lib" \ The macOS-specific instructions eventually get running configure as follows:ĬFLAGS="-I$(brew -prefix gdbm)/include -I$(brew -prefix xz)/include" \ Compiling Python from source is well documented. To get the specific version of Python needed for the application (3.9.x), I knew I would have to compile it myself. Problem: How to Compile Python with a Statically Linked OpenSSL on macOS The application runs on macOS and on Linux, but this post deals with macOS specifically. And, we can’t rely on the destination already having the correct version of Python installed. The application itself is not written in Python, but it needs to run Python programs. Windows support though is not guaranteed.I’ve recently worked on software that requires a bundled installation of Python. This tool was initially developed and tested on Linux systems, so it does also support Unix-like systems: BSDs, Mac OS… Or alternatively, if python is in the path, run the following commands: To launch openssl-python tool, just download the source code, and run the following command: In case it doesn’t, try consulting the official ( ) or consult your operating system’ documentation on how to install new software. Usually, this dependency exists by default in most of the supported platforms(see below). It permits encrypting/decrypting files, as well as generating RSA keys, encrypting private RSA keys, signing files using an RSA key, and also verifying signatures using RSA.īefore running this tool, the following dependency must be installed, as well as being on the path: ![]() This tool is a command line interface to OpenSSL, written with Python3. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |