[New-bugs-announce] [issue17846] Building Python on Windows - Supplementary info

michael kearney report at bugs.python.org
Thu Apr 25 21:54:24 CEST 2013


New submission from michael kearney:

This is not a bug per se, though perhaps documentation rewrite might be appropriate.

I've been building python for windows for several years now. I have found that it is unnecessarily problematic. Perhaps my expectations are too high. When I started building python, I expected to build a whole stable version of python thing without error. In my experience, 
it is not true that one can build python on windows by simply loading the .sln file into Visual studio, selecting Debug or Release, and then clicking build.

Over time I have worked out steps that allow me to build all bits of python and minimize the aggravation and failures. These steps follow. Hopefully they will help folks to avoid some of the problems I encountered. Perhaps this will attract commentary that will document the way things actually should be done. I would be happy to stand corrected and know that there is a simple single point and click or single line command that would build python on windows.

Regardless, here you go. 

The online directions for downloading the development version source are fine and can be found at http://docs.python.org/devguide/. Mercurial must be installed on your machine. Stable released version source is available on the download page. 

Python building/rebuilding assumes the existence of subversion, perl, and a version of Visual Studio on your system. If you have all three, skip to step three. Otherwise download and install any of those
that are missing. If it is  necessary to have on hand multiple versions of python built from scratch, you should isolate them from each other by putting them in a container directory perhaps of the same name.

e.g. I use a style like python331/python331, python32/python32

where the subdirectory is the source root directory. I use the upper directory to isolate the external subprojects created by the buildbots described later. If you don't do this, the buildbots of one version can wipe out required subprojects of another version of python. I can assure you this will cause you a lot of confusion until you realize the source of the problem.

0. Download and install at least a subversion client and add the executable to your path.
   I got mine from Collabnet and here is how it appears in my path
   "C:\Program Files\CollabNet\Subversion Client"

1. Download and install  perl and add the executable to your path  
   I vaguely recall I downloaded ActivePerl
   Your Perl path will look something like this.
       C:\Perl\site\bin;C:\Perl\bin

2. Download and install VC++ express and add the bin area to your path
   Your VC++ bin path will look something like this:
   C:\Program Files\Microsoft Visual Studio 10.0\VC\bin

   I use the free version of VC++, which may be the source of all my 
   python build issues.
   When I load the solution file which you will see later, VC++    
   complains that the version
   I have doesn't support various features. It is free though and I am 
   able to work with it. 

2  Download and install nasm:
   There are several downloading sites. This seems to be the latest and    
   greatest. 
   http://www.windows7download.com/win7-nasm/ldyuniel.html

4. Download and build the external subprojects with the buildbots using 
   either: 
    Tools\buildbot\external.bat         # for 32 bit processors
    Tools\buildbot\external-amd64.bat   # for 64 bit processors
    from the root directory or your python distribution.
    This step will download the correct versions of the external 
    projects for this version of python. There are several projects

4. openssl is used for python on windows
   ssl rarely succeeds if you proceed to build using "pcbuild.sln: 

   The following steps will resolve many problems if you executing them 
   before building with the .sln file

   cd into the openssl directory created by the buildbots
     perl util\mkdef.pl crypto ssl update
     perl Configure VC-WIN32 --prefix=C:\opt\openssl-1.0.1d
     ms\do_nasm  

   You may get compilation errors anyway when you attempt to build the 
   .sln file with Visual Studio. The errors I have seen have always been 
   the same type, namely a forced error contained within a block of   
   conditional code. In all cases so far I have been able to comment out 
   the forced error. Most recently I had to comment out code blocks in 
   mdc2.h and idea.h.
   
   Historically, the openssl build has not had a "clean" function. This 
   used to cause me a lot of problems if rebuilding was required for  
   whatever reason. I cleaned the project by deleting and letting the 
   buildbot download again what was required. 

5. Finally Build python and its internal subprojects  
     open the solution "pcbuild.sln" in Visual Studio (VC++ in my case)
       - If you have an express version, then ignore the warning 
     select the  configuration  Release or Debug
        "Release" builds python.exe
        "Debug" builds python_d.exe 
     select the platform   Win32 or x64
     build the solution.   
       Right click "Solution 'pccuild'"  and select
         build - for fresh build
         clean - to delete all files created for build , i.e. objects, 
                 libraries, executable, etc.
         rebuild - clean and build everything
     Note that you can clean and build individual subprojects by just 
     right clicking on the subproject and selecting build, clean, or 
     rebuild for that project

----------
messages: 187810
nosy: michael.kearney
priority: normal
severity: normal
status: open
title: Building Python on Windows - Supplementary info
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17846>
_______________________________________


More information about the New-bugs-announce mailing list