[Python-Dev] Compile Python on Windows (OpenSSL)

Zachary Ware zachary.ware+pydev at gmail.com
Tue Jan 13 23:15:08 CET 2015


On Tue, Jan 13, 2015 at 4:04 PM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> Hi,
>
> To compile Python on Windows, there are a few information in the
> Developer Guide:
> https://docs.python.org/devguide/setup.html#windows-compiling
>
> Python 3.5 now requires Visual Studio 2010 *SP1*, or newer Visual Studio:
> http://bugs.python.org/issue22919#msg233637
>
> I found PCbuild\readme.txt which is not mentionned in the devguide :-/
> https://hg.python.org/cpython/file/56f717235c45/PCbuild/readme.txt
> (at least not on the Windows section of the setup page)

The first line of the section you linked to is "The readme included in
the solution has more details, especially on what additional software
is required to build which parts of Python.", and 'readme' is a link
to the readme on h.p.o. :)

> I found some clues to build OpenSSL to be able to build the Python ssl
> module, but I still have issues.
>
> Is there a more complete documentation?

The readme *should* be fairly comprehensive as I rewrote it last year,
but it may still be lacking since I wrote it after doing regular
builds for a year or two.  In particular, the Quick Start guide at the
very beginning of the readme should be enough to get you going.

"""
Quick Start Guide
-----------------

1.  Install Microsoft Visual Studio 2015, any edition.
2.  Install Subversion, and make sure 'svn.exe' is on your PATH.
3.  Run "build.bat -e" to build Python in 32-bit Release configuration.
4.  (Optional, but recommended) Run the test suite with "rt.bat -q".
"""

That should be enough to build Python, OpenSSL, Tcl/Tk/Tix, and all
other external projects.  One thing that might be a gotcha there, if
you're using a Command Prompt window that you opened before installing
SVN, you'll need to either adjust PATH manually or open a new Command
Prompt to get the PATH changes.

> I found how to install svn.exe, perl.exe and nasm.exe, but not how to
> install nmake.exe. I don't know the command to build OpenSSL.

Perl is not necessary if you're using sources from svn.python.org
(which "build.bat -e" will do).  You also no longer need to install
NASM.  nmake.exe is part of Visual Studio (or the Windows SDK,
whichever).

> I don't care of building OpenSSL, my goal is only to build the Python
> ssl module. Is there a way to install a development version of OpenSSL
> (.lib files if I remember correctly) from an installer/binary?
>
> My draft notes:
>
> +Compile CPython on Windows
> +==========================
> +
> +To build the Python ssl extension:
> +
> +Need:
> +
> +* Visual Studio 2010 SP1 or newer
> +* CPython source code (default branch: 3.5)
> +* perl binary: ActivePerl
> +* svn binary, ex: SilkSVN
> +* nasm and nmake binaries: compile NASM (install the binary doesn't
> install nmake)
> +
> +Read PCbuild/readme.txt.
> +
> +* Build Python (in debug mode)
> +* Type: PCbuild\get_externals.bat
> +* Type: PCbuild\win32\python_d.exe PCbuild\prepare_ssl.py
> externals\openssl-1.0.1j

You don't need to use prepare_ssl.py if you use get_externals.bat.
The 'ssl' section of the readme should cover that (if it can be
clarified, please point out the problems to me!).

-- 
Zach


More information about the Python-Dev mailing list