blob: 79262ab95d6c9ede31e343de047da6fb2f636053 [file] [log] [blame]
Tim Petersff8505d2004-01-03 05:45:59 +00001Building Python using VC++ 6.0 or 5.0
2-------------------------------------
3This directory is used to build Python for Win32 platforms, e.g. Windows
495, 98 and NT. It requires Microsoft Visual C++ 6.x or 5.x.
5(For other Windows platforms and compilers, see ../readme.txt.)
6
7All you need to do is open the workspace "pcbuild.dsw" in MSVC++, select
8the Debug or Release setting (using Build -> Set Active Configuration...),
9and build the projects.
10
11The proper order to build subprojects:
12
131) pythoncore (this builds the main Python DLL and library files,
14 python21.{dll, lib} in Release mode)
15 NOTE: in previous releases, this subproject was
16 named after the release number, e.g. python20.
17
182) python (this builds the main Python executable,
19 python.exe in Release mode)
20
213) the other subprojects, as desired or needed (note: you probably don't
22 want to build most of the other subprojects, unless you're building an
23 entire Python distribution from scratch, or specifically making changes
24 to the subsystems they implement; see SUBPROJECTS below)
25
26When using the Debug setting, the output files have a _d added to
27their name: python21_d.dll, python_d.exe, parser_d.pyd, and so on.
28
29SUBPROJECTS
30-----------
31These subprojects should build out of the box. Subprojects other than the
32main ones (pythoncore, python, pythonw) generally build a DLL (renamed to
33.pyd) from a specific module so that users don't have to load the code
34supporting that module unless they import the module.
35
36pythoncore
37 .dll and .lib
38python
39 .exe
40pythonw
41 pythonw.exe, a variant of python.exe that doesn't pop up a DOS box
Tim Petersff8505d2004-01-03 05:45:59 +000042_socket
43 socketmodule.c
Tim Petersff8505d2004-01-03 05:45:59 +000044_testcapi
45 tests of the Python C API, run via Lib/test/test_capi.py, and
46 implemented by module Modules/_testcapimodule.c
Tim Petersff8505d2004-01-03 05:45:59 +000047pyexpat
48 Python wrapper for accelerated XML parsing, which incorporates stable
49 code from the Expat project: http://sourceforge.net/projects/expat/
50select
51 selectmodule.c
52unicodedata
53 large tables of Unicode data
Tim Petersff8505d2004-01-03 05:45:59 +000054winsound
55 play sounds (typically .wav files) under Windows
56
57The following subprojects will generally NOT build out of the box. They
58wrap code Python doesn't control, and you'll need to download the base
59packages first and unpack them into siblings of PCbuilds's parent
60directory; for example, if your PCbuild is .......\dist\src\PCbuild\,
61unpack into new subdirectories of dist\.
62
63_tkinter
64 Python wrapper for the Tk windowing system. Requires building
Thomas Wouters89f507f2006-12-13 04:49:30 +000065 Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.12.
Tim Petersff8505d2004-01-03 05:45:59 +000066
67 Get source
68 ----------
Thomas Wouters89f507f2006-12-13 04:49:30 +000069 In the dist directory, run
70 svn export http://svn.python.org/projects/external/tcl8.4.12
71 svn export http://svn.python.org/projects/external/tk8.4.12
72 svn export http://svn.python.org/projects/external/tix-8.4.0
Tim Petersff8505d2004-01-03 05:45:59 +000073
Thomas Wouters89f507f2006-12-13 04:49:30 +000074 Build Tcl first (done here w/ MSVC 6 on Win2K)
Tim Petersff8505d2004-01-03 05:45:59 +000075 ---------------
Thomas Wouters89f507f2006-12-13 04:49:30 +000076 cd dist\tcl8.4.12\win
77 run vcvars32.bat
Tim Petersff8505d2004-01-03 05:45:59 +000078 nmake -f makefile.vc
Thomas Wouters89f507f2006-12-13 04:49:30 +000079 nmake -f makefile.vc INSTALLDIR=..\..\tcltk install
Tim Petersff8505d2004-01-03 05:45:59 +000080
81 XXX Should we compile with OPTS=threads?
82
Thomas Wouters89f507f2006-12-13 04:49:30 +000083 Optional: run tests, via
84 nmake -f makefile.vc test
85
86 all.tcl: Total 10835 Passed 10096 Skipped 732 Failed 7
87 Sourced 129 Test Files.
88 Files with failing tests: exec.test expr.test io.test main.test string.test stri
89 ngObj.test
Tim Petersff8505d2004-01-03 05:45:59 +000090
91 Build Tk
92 --------
Thomas Wouters89f507f2006-12-13 04:49:30 +000093 cd dist\tk8.4.12\win
94 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12
95 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 INSTALLDIR=..\..\tcltk install
Tim Petersff8505d2004-01-03 05:45:59 +000096
97 XXX Should we compile with OPTS=threads?
98
99 XXX I have no idea whether "nmake -f makefile.vc test" passed or
100 XXX failed. It popped up tons of little windows, and did lots of
101 XXX stuff, and nothing blew up.
102
Thomas Wouters89f507f2006-12-13 04:49:30 +0000103 Built Tix
104 ---------
105 cd dist\tix-8.4.0\win
106 nmake -f python.mak
107 nmake -f python.mak install
Tim Petersff8505d2004-01-03 05:45:59 +0000108
109bz2
110 Python wrapper for the libbz2 compression library. Homepage
111 http://sources.redhat.com/bzip2/
Thomas Wouters89f507f2006-12-13 04:49:30 +0000112 Download the source from the python.org copy into the dist
113 directory:
Tim Petersff8505d2004-01-03 05:45:59 +0000114
Thomas Wouters89f507f2006-12-13 04:49:30 +0000115 svn export http://svn.python.org/projects/external/bzip2-1.0.3
Tim Petersff8505d2004-01-03 05:45:59 +0000116
Thomas Wouters89f507f2006-12-13 04:49:30 +0000117 And requires building bz2 first.
Tim Petersff8505d2004-01-03 05:45:59 +0000118
Thomas Wouters89f507f2006-12-13 04:49:30 +0000119 cd dist\bzip2-1.0.3
120 nmake -f makefile.msc
121
122 All of this managed to build bzip2-1.0.3\libbz2.lib, which the Python
Tim Petersff8505d2004-01-03 05:45:59 +0000123 project links in.
124
125
126_bsddb
Thomas Wouters89f507f2006-12-13 04:49:30 +0000127 To use the version of bsddb that Python is built with by default, invoke
128 (in the dist directory)
Tim Petersff8505d2004-01-03 05:45:59 +0000129
Thomas Wouters89f507f2006-12-13 04:49:30 +0000130 svn export http://svn.python.org/projects/external/db-4.4.20
Tim Petersff8505d2004-01-03 05:45:59 +0000131
Thomas Wouters89f507f2006-12-13 04:49:30 +0000132 Then open db-4.4.20\build_win32\Berkeley_DB.dsw and build the "db_static"
133 project for "Release" mode.
Tim Petersff8505d2004-01-03 05:45:59 +0000134
Thomas Wouters89f507f2006-12-13 04:49:30 +0000135 Alternatively, if you want to start with the original sources,
136 go to Sleepycat's download page:
137 http://www.sleepycat.com/downloads/releasehistorybdb.html
Tim Petersff8505d2004-01-03 05:45:59 +0000138
Thomas Wouters89f507f2006-12-13 04:49:30 +0000139 and download version 4.4.20.
Tim Petersff8505d2004-01-03 05:45:59 +0000140
Thomas Wouters89f507f2006-12-13 04:49:30 +0000141 With or without strong cryptography? You can choose either with or
142 without strong cryptography, as per the instructions below. By
143 default, Python is built and distributed WITHOUT strong crypto.
Tim Petersff8505d2004-01-03 05:45:59 +0000144
Thomas Wouters89f507f2006-12-13 04:49:30 +0000145 Unpack the sources; if you downloaded the non-crypto version, rename
146 the directory from db-4.4.20.NC to db-4.4.20.
147
148 Now apply any patches that apply to your version.
Tim Petersff8505d2004-01-03 05:45:59 +0000149
150 To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py
151 is then enabled. Running in verbose mode may be helpful.
152
153 XXX The test_bsddb3 tests don't always pass, on Windows (according to
Thomas Wouters89f507f2006-12-13 04:49:30 +0000154 XXX me) or on Linux (according to Barry). (I had much better luck
155 XXX on Win2K than on Win98SE.) The common failure mode across platforms
Tim Petersff8505d2004-01-03 05:45:59 +0000156 XXX is
157 XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable
158 XXX to join the environment')
159 XXX
160 XXX and it appears timing-dependent. On Win2K I also saw this once:
161 XXX
162 XXX test02_SimpleLocks (bsddb.test.test_thread.HashSimpleThreaded) ...
163 XXX Exception in thread reader 1:
164 XXX Traceback (most recent call last):
165 XXX File "C:\Code\python\lib\threading.py", line 411, in __bootstrap
166 XXX self.run()
167 XXX File "C:\Code\python\lib\threading.py", line 399, in run
168 XXX apply(self.__target, self.__args, self.__kwargs)
169 XXX File "C:\Code\python\lib\bsddb\test\test_thread.py", line 268, in
170 XXX readerThread
171 XXX rec = c.next()
172 XXX DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed
173 XXX to resolve a deadlock')
174 XXX
175 XXX I'm told that DBLockDeadlockError is expected at times. It
176 XXX doesn't cause a test to fail when it happens (exceptions in
177 XXX threads are invisible to unittest).
178
179
180_ssl
181 Python wrapper for the secure sockets library.
182
183 Get the latest source code for OpenSSL from
184 http://www.openssl.org
185
186 You (probably) don't want the "engine" code. For example, get
187 openssl-0.9.6g.tar.gz
188 not
189 openssl-engine-0.9.6g.tar.gz
190
191 Unpack into the "dist" directory, retaining the folder name from
192 the archive - for example, the latest stable OpenSSL will install as
193 dist/openssl-0.9.6g
194
195 You can (theoretically) use any version of OpenSSL you like - the
196 build process will automatically select the latest version.
197
198 You must also install ActivePerl from
199 http://www.activestate.com/Products/ActivePerl/
200 as this is used by the OpenSSL build process. Complain to them <wink>.
201
Christian Heimes4c3eda32008-01-04 15:35:04 +0000202 The MSVC project simply invokes PC/VC6/build_ssl.py to perform
Tim Petersff8505d2004-01-03 05:45:59 +0000203 the build. This Python script locates and builds your OpenSSL
204 installation, then invokes a simple makefile to build the final .pyd.
205
Tim Petersff8505d2004-01-03 05:45:59 +0000206 build_ssl.py attempts to catch the most common errors (such as not
207 being able to find OpenSSL sources, or not being able to find a Perl
208 that works with OpenSSL) and give a reasonable error message.
209 If you have a problem that doesn't seem to be handled correctly
210 (eg, you know you have ActivePerl but we can't find it), please take
211 a peek at build_ssl.py and suggest patches. Note that build_ssl.py
212 should be able to be run directly from the command-line.
213
214 build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do
215 this by hand.
216
Tim Petersff8505d2004-01-03 05:45:59 +0000217
218YOUR OWN EXTENSION DLLs
219-----------------------
220If you want to create your own extension module DLL, there's an example
221with easy-to-follow instructions in ../PC/example/; read the file
222readme.txt there first.