11Building Python using VC++ 9.0
22------------------------------
33
4- This directory is used to build Python for Win32 platforms, e.g. Windows
5- 2000, XP and Vista. It requires Microsoft Visual C++ 9.0
6- (a.k.a. Visual Studio .NET 2008).
7- (For other Windows platforms and compilers, see ../PC/readme.txt.)
4+ This directory is used to build Python for Win32 and x64 platforms, e.g.
5+ Windows 2000, XP, Vista and Windows Server 2008. In order to build 32-bit
6+ debug and release executables, Microsoft Visual C++ 2008 Express Edition is
7+ required at the very least. In order to build 64-bit debug and release
8+ executables, Visual Studio 2008 Standard Edition is required at the very
9+ least. In order to build all of the above, as well as generate release builds
10+ that make use of Profile Guided Optimisation (PG0), Visual Studio 2008
11+ Professional Edition is required at the very least. The official Python
12+ releases are built with this version of Visual Studio.
13+
14+ For other Windows platforms and compilers, see ../PC/readme.txt.
815
916All you need to do is open the workspace "pcbuild.sln" in Visual Studio,
1017select the desired combination of configuration and platform and eventually
@@ -59,7 +66,7 @@ Visual Studio 2008 uses version 9 of the C runtime (MSVCRT9). The executables
5966are linked to a CRT "side by side" assembly which must be present on the target
6067machine. This is avalible under the VC/Redist folder of your visual studio
6168distribution. On XP and later operating systems that support
62- side-by-side assemblies it is not enough to have the msvcrt80 .dll present,
69+ side-by-side assemblies it is not enough to have the msvcrt90 .dll present,
6370it has to be there as a whole assembly, that is, a folder with the .dll
6471and a .manifest. Also, a check is made for the correct version.
6572Therefore, one should distribute this assembly with the dlls, and keep
@@ -95,79 +102,19 @@ unicodedata
95102winsound
96103 play sounds (typically .wav files) under Windows
97104
98- The following subprojects will generally NOT build out of the box. They
99- wrap code Python doesn't control, and you'll need to download the base
100- packages first and unpack them into siblings of PCbuilds's parent
101- directory; for example, if your PCbuild is ..\dist\py3k\PCbuild\,
102- unpack into new subdirectories of ..\dist\.
103-
105+ Python-controlled subprojects that wrap external projects:
106+ _bsddb
107+ Wraps Berkeley DB 4.4.20, which is currently built by _bsddb44.vcproj.
108+ project (see below).
109+ _sqlite3
110+ Wraps SQLite 3.3.4, which is currently built by sqlite3.vcproj (see below).
104111_tkinter
105- Python wrapper for the Tk windowing system. Requires building
106- Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.16.
107-
108- NOTE: The 64 build builds must land in tcltk64 instead of tcltk.
109-
110- Get source
111- ----------
112- In the dist directory, run
113- svn export http://svn.python.org/projects/external/tcl8.4.16
114- svn export http://svn.python.org/projects/external/tk8.4.16
115- svn export http://svn.python.org/projects/external/tix-8.4.0
116-
117- Build with build_tkinter.py
118- ---------------------------
119- The PCbuild directory contains a Python script which automates all
120- steps. Run the script in a Visual Studio 2008 command prompt with
121-
122- python build_tkinter.py Win32
123-
124- Use x64 instead of Win32 for the x64 platform.
125-
126- NOTE: Tcl/Tk 8.4 doesn't compile for x64.
127-
128- Build Tcl first
129- ---------------
130- Use "Start -> All Programs -> Microsoft Visual Studio 2008
131- -> Visual Studio Tools -> Visual Studio 2008 Command Prompt"
132- to get a shell window with the correct environment settings
133- cd dist\tcl8.4.16\win
134- nmake -f makefile.vc
135- nmake -f makefile.vc INSTALLDIR=..\..\tcltk install
136-
137- XXX Should we compile with OPTS=threads?
138-
139- Optional: run tests, via
140- nmake -f makefile.vc test
141-
142- On WinXP Pro, wholly up to date as of 30-Aug-2004:
143- all.tcl: Total 10678 Passed 9969 Skipped 709 Failed 0
144- Sourced 129 Test Files.
145-
146- Build Tk
147- --------
148- cd dist\tk8.4.16\win
149- nmake -f makefile.vc TCLDIR=..\..\tcl8.4.16
150- nmake -f makefile.vc TCLDIR=..\..\tcl8.4.16 INSTALLDIR=..\..\tcltk install
151-
152- XXX Should we compile with OPTS=threads?
153-
154- XXX Our installer copies a lot of stuff out of the Tcl/Tk install
155- XXX directory. Is all of that really needed for Python use of Tcl/Tk?
156-
157- Optional: run tests, via
158- nmake -f makefile.vc TCLDIR=..\..\tcl8.4.16 test
159-
160- On WinXP Pro, wholly up to date as of 30-Aug-2004:
161- all.tcl: Total 8420 Passed 6826 Skipped 1581 Failed 13
162- Sourced 91 Test Files.
163- Files with failing tests: canvImg.test scrollbar.test textWind.test winWm.test
164-
165- Built Tix
166- ---------
167- cd dist\tix-8.4.0\win
168- nmake -f python9.mak
169- nmake -f python9.mak install
170-
112+ Wraps the Tk windowing system. Unlike _bsddb and _sqlite3, there's no
113+ corresponding tcltk.vcproj-type project that builds Tcl/Tk from vcproj's
114+ within our pcbuild.sln, which means this module expects to find a
115+ pre-built Tcl/Tk in either ..\..\tcltk for 32-bit or ..\..\tcltk64 for
116+ 64-bit (relative to this directory). See below for instructions to build
117+ Tcl/Tk.
171118bz2
172119 Python wrapper for the libbz2 compression library. Homepage
173120 http://sources.redhat.com/bzip2/
176123
177124 svn export http://svn.python.org/projects/external/bzip2-1.0.3
178125
126+ ** NOTE: if you use the Tools\buildbot\external(-amd64).bat approach for
127+ obtaining external sources then you don't need to manually get the source
128+ above via subversion. **
129+
179130 A custom pre-link step in the bz2 project settings should manage to
180131 build bzip2-1.0.3\libbz2.lib by magic before bz2.pyd (or bz2_d.pyd) is
181132 linked in PCbuild\.
@@ -186,70 +137,17 @@ bz2
186137 All of this managed to build libbz2.lib in
187138 bzip2-1.0.3\$platform-$configuration\, which the Python project links in.
188139
189-
190- _bsddb
191- To use the version of bsddb that Python is built with by default, invoke
192- (in the dist directory)
193-
194- svn export http://svn.python.org/projects/external/db-4.4.20
195-
196- Next open the solution file db-4.4.20\build_win32\Berkeley_DB.sln with
197- Visual Studio and convert the projects to the new format. VS 2008
198- builds the necessary libraries in a pre-link step of _bsddb. You
199- have to add "$(VCInstallDir)vcpackages" to the search path first
200- (Tools -> Options -> Projects and Solutions -> VC++ Directories,
201- Platform: Win32, Show directories for: Executable files).
202-
203- The _bsddb subprojects depends only on the db_static project of
204- Berkeley DB. You have to choose either "Release", "Release AMD64", "Debug"
205- or "Debug AMD64" as configuration. For the AND64 builds, you need to
206- create the "x64" platform first (in Solution Platforms\Configuration
207- Manager...)
208-
209- Alternatively, if you want to start with the original sources,
210- go to Sleepycat's download page:
211- http://www.sleepycat.com/downloads/releasehistorybdb.html
212-
213- and download version 4.4.20.
214-
215- With or without strong cryptography? You can choose either with or
216- without strong cryptography, as per the instructions below. By
217- default, Python is built and distributed WITHOUT strong crypto.
218-
219- Unpack the sources; if you downloaded the non-crypto version, rename
220- the directory from db-4.4.20.NC to db-4.4.20.
221-
222- Now apply any patches that apply to your version.
223-
224- Open
225- db-4.4.20\docs\ref\build_win\intro.html
226-
227- and follow the "Windows->Building Berkeley DB with Visual C++ .NET"
228- instructions for building the Sleepycat
229- software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory.
230- Build the "db_static" project, for "Release" mode.
231-
232- To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py
233- is then enabled. Running in verbose mode may be helpful.
234-
235- _sqlite3
236- Python wrapper for SQLite library.
237-
238- Get the source code through
239-
240- svn export http://svn.python.org/projects/external/sqlite-source-3.3.4
241-
242- To use the extension module in a Python build tree, copy sqlite3.dll into
243- the PCbuild folder. The source directory in svn also contains a .def file
244- from the binary release of sqlite3.
245-
246140_ssl
247141 Python wrapper for the secure sockets library.
248142
249143 Get the source code through
250144
251145 svn export http://svn.python.org/projects/external/openssl-0.9.8g
252146
147+ ** NOTE: if you use the Tools\buildbot\external(-amd64).bat approach for
148+ obtaining external sources then you don't need to manually get the source
149+ above via subversion. **
150+
253151 Alternatively, get the latest version from http://www.openssl.org.
254152 You can (theoretically) use any version of OpenSSL you like - the
255153 build process will automatically select the latest version.
@@ -285,6 +183,69 @@ _ssl
285183 build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do
286184 this by hand.
287185
186+ The subprojects above wrap external projects Python doesn't control, and as
187+ such, a little more work is required in order to download the relevant source
188+ files for each project before they can be built. The buildbots do this each
189+ time they're built, so the easiest approach is to run either external.bat or
190+ external-amd64.bat in the ..\Tools\buildbot directory from ..\, i.e.:
191+
192+ C:\..\svn.python.org\projects\python\trunk\PCbuild>cd ..
193+ C:\..\svn.python.org\projects\python\trunk>Tools\buildbot\external.bat
194+
195+ This extracts all the external subprojects from http://svn.python.org/external
196+ via Subversion (so you'll need an svn.exe on your PATH) and places them in
197+ ..\.. (relative to this directory). The external(-amd64).bat scripts will
198+ also build a debug build of Tcl/Tk; there aren't any equivalent batch files
199+ for building release versions of Tcl/Tk lying around in the Tools\buildbot
200+ directory. If you need to build a release version of Tcl/Tk it isn't hard
201+ though, take a look at the relevant external(-amd64).bat file and find the
202+ two nmake lines, then call each one without the 'DEBUG=1' parameter, i.e.:
203+
204+ The external-amd64.bat file contains this for tcl:
205+ nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install
206+
207+ So for a release build, you'd call it as:
208+ nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install
209+
210+ XXX Should we compile with OPTS=threads?
211+ XXX Our installer copies a lot of stuff out of the Tcl/Tk install
212+ XXX directory. Is all of that really needed for Python use of Tcl/Tk?
213+
214+ This will be cleaned up in the future; ideally Tcl/Tk will be brought into our
215+ pcbuild.sln as custom .vcproj files, just as we've recently done with the
216+ _bsddb44.vcproj and sqlite3.vcproj files, which will remove the need for
217+ Tcl/Tk to be built separately via a batch file.
218+
219+ XXX trent.nelson 02-Apr-08:
220+ Having the external subprojects in ..\.. relative to this directory is a
221+ bit of a nuisance when you're working on py3k and trunk in parallel and
222+ your directory layout mimics that of Python's subversion layout, e.g.:
223+
224+ C:\..\svn.python.org\projects\python\trunk
225+ C:\..\svn.python.org\projects\python\branches\py3k
226+ C:\..\svn.python.org\projects\python\branches\release25-maint
227+
228+ I'd like to change things so that external subprojects are fetched from
229+ ..\external instead of ..\.., then provide some helper scripts or batch
230+ files that would set up a new ..\external directory with svn checkouts of
231+ the relevant branches in http://svn.python.org/projects/external/, or
232+ alternatively, use junctions to link ..\external with a pre-existing
233+ externals directory being used by another branch. i.e. if I'm usually
234+ working on trunk (and have previously created trunk\external via the
235+ provided batch file), and want to do some work on py3k, I'd set up a
236+ junction as follows (using the directory structure above as an example):
237+
238+ C:\..\python\trunk\external <- already exists and has built versions
239+ of the external subprojects
240+
241+ C:\..\python\branches\py3k>linkd.exe external ..\..\trunk\external
242+ Link created at: external
243+
244+ Only a slight tweak would be needed to the buildbots such that bots
245+ building trunk and py3k could make use of the same facility. (2.5.x
246+ builds need to be kept separate as they're using Visual Studio 7.1.)
247+ /XXX trent.nelson 02-Apr-08
248+
288249Building for Itanium
289250--------------------
290251
0 commit comments