blob: 3abb8447bcf1d01845ba20ba3532f5309a4c87cb [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
42_csv
43 C support for the comma-separated values module
44_socket
45 socketmodule.c
46_sre
47 Unicode-aware regular expression engine
48_symtable
49 the _symtable module, symtablemodule.c
50_testcapi
51 tests of the Python C API, run via Lib/test/test_capi.py, and
52 implemented by module Modules/_testcapimodule.c
53datetime
54 datetimemodule.c
55mmap
56 mmapmodule.c
57parser
58 the parser module
59pyexpat
60 Python wrapper for accelerated XML parsing, which incorporates stable
61 code from the Expat project: http://sourceforge.net/projects/expat/
62select
63 selectmodule.c
64unicodedata
65 large tables of Unicode data
66winreg
67 Windows registry API
68winsound
69 play sounds (typically .wav files) under Windows
70
71The following subprojects will generally NOT build out of the box. They
72wrap code Python doesn't control, and you'll need to download the base
73packages first and unpack them into siblings of PCbuilds's parent
74directory; for example, if your PCbuild is .......\dist\src\PCbuild\,
75unpack into new subdirectories of dist\.
76
77_tkinter
78 Python wrapper for the Tk windowing system. Requires building
79 Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.3:
80
81 Get source
82 ----------
83 Go to
84 http://prdownloads.sourceforge.net/tcl/
85 and download
86 tcl843-src.zip
87 tk843-src.zip
88 Unzip into
89 dist\tcl8.4.3\
90 dist\tk8.4.3\
91 respectively.
92
93 Build Tcl first (done here w/ MSVC 6 on Win98SE)
94 ---------------
95 cd dist\tcl8.4.3\win
96 run vcvars32.bat [necessary even on Win2K]
97 nmake -f makefile.vc
98 nmake -f makefile.vc INSTALLDIR=..\..\tcl84 install
99
100 XXX Should we compile with OPTS=threads?
101
102 XXX Some tests failed in "nmake -f makefile.vc test".
103 XXX all.tcl: Total 10480 Passed 9743 Skipped 719 Failed 18
104 XXX
105 XXX That was on Win98SE. On Win2K:
106 XXX all.tcl Total 10480 Passed 9781 Skipped 698 Failed 1
107
108 Build Tk
109 --------
110 cd dist\tk8.4.3\win
111 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.3
112 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.3 INSTALLDIR=..\..\tcl84 install
113
114 XXX Should we compile with OPTS=threads?
115
116 XXX I have no idea whether "nmake -f makefile.vc test" passed or
117 XXX failed. It popped up tons of little windows, and did lots of
118 XXX stuff, and nothing blew up.
119
120 XXX Our installer copies a lot of stuff out of the Tcl/Tk install
121 XXX directory. Is all of that really needed for Python use of Tcl/Tk?
122
123 Make sure the installer matches
124 -------------------------------
125 Ensure that the Wise compiler vrbl _TCLDIR_ is set to the name of
126 the common Tcl/Tk installation directory (tcl84 for the instructions
127 above). This is needed so the installer can copy various Tcl/Tk
128 files into the Python distribution.
129
130
131zlib
132 Python wrapper for the zlib compression library. Get the source code
133 for version 1.1.4 from a convenient mirror at:
134 http://www.gzip.org/zlib/
135 Unpack into dist\zlib-1.1.4.
136 A custom pre-link step in the zlib project settings should manage to
137 build zlib-1.1.4\zlib.lib by magic before zlib.pyd (or zlib_d.pyd) is
138 linked in PCbuild\.
139 However, the zlib project is not smart enough to remove anything under
140 zlib-1.1.4\ when you do a clean, so if you want to rebuild zlib.lib
141 you need to clean up zlib-1.1.4\ by hand.
142
143bz2
144 Python wrapper for the libbz2 compression library. Homepage
145 http://sources.redhat.com/bzip2/
146 Download the source tarball, bzip2-1.0.2.tar.gz.
147 Unpack into dist\bzip2-1.0.2. WARNING: If you're using WinZip, you
148 must disable its "TAR file smart CR/LF conversion" feature (under
149 Options -> Configuration -> Miscellaneous -> Other) for the duration.
150
151 A custom pre-link step in the bz2 project settings should manage to
152 build bzip2-1.0.2\libbz2.lib by magic before bz2.pyd (or bz2_d.pyd) is
153 linked in PCbuild\.
154 However, the bz2 project is not smart enough to remove anything under
155 bzip2-1.0.2\ when you do a clean, so if you want to rebuild bzip2.lib
156 you need to clean up bzip2-1.0.2\ by hand.
157
158 The build step shouldn't yield any warnings or errors, and should end
159 by displaying 6 blocks each terminated with
160 FC: no differences encountered
161 If FC finds differences, see the warning abou WinZip above (when I
162 first tried it, sample3.ref failed due to CRLF conversion).
163
164 All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python
165 project links in.
166
167
168_bsddb
169 Go to Sleepycat's download page:
170 http://www.sleepycat.com/download/
171
172 and download version 4.1.25. The file name is db-4.1.25.NC.zip.
173 XXX with or without strong cryptography? I picked "without".
174
175 Unpack into
176 dist\db-4.1.25
177
178 [If using WinZip to unpack the db-4.1.25.NC distro, that requires
179 renaming the directory (to remove ".NC") after unpacking.
180 ]
181
182 Open
183 dist\db-4.1.25\docs\index.html
184
185 and follow the Windows instructions for building the Sleepycat
186 software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory.
187 Build the Release version ("build_all -- Win32 Release").
188
189 XXX We're actually linking against Release_static\libdb41s.lib.
190 XXX This yields the following warnings:
191"""
192Compiling...
193_bsddb.c
194Linking...
195 Creating library ./_bsddb.lib and object ./_bsddb.exp
196LINK : warning LNK4049: locally defined symbol "_malloc" imported
197LINK : warning LNK4049: locally defined symbol "_free" imported
198LINK : warning LNK4049: locally defined symbol "_fclose" imported
199LINK : warning LNK4049: locally defined symbol "_fopen" imported
200_bsddb.pyd - 0 error(s), 4 warning(s)
201"""
202 XXX This isn't encouraging, but I don't know what to do about it.
203
204 To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py
205 is then enabled. Running in verbose mode may be helpful.
206
207 XXX The test_bsddb3 tests don't always pass, on Windows (according to
208 XXX me) or on Linux (according to Barry). I had much better luck
209 XXX on Win2K than on Win98SE. The common failure mode across platforms
210 XXX is
211 XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable
212 XXX to join the environment')
213 XXX
214 XXX and it appears timing-dependent. On Win2K I also saw this once:
215 XXX
216 XXX test02_SimpleLocks (bsddb.test.test_thread.HashSimpleThreaded) ...
217 XXX Exception in thread reader 1:
218 XXX Traceback (most recent call last):
219 XXX File "C:\Code\python\lib\threading.py", line 411, in __bootstrap
220 XXX self.run()
221 XXX File "C:\Code\python\lib\threading.py", line 399, in run
222 XXX apply(self.__target, self.__args, self.__kwargs)
223 XXX File "C:\Code\python\lib\bsddb\test\test_thread.py", line 268, in
224 XXX readerThread
225 XXX rec = c.next()
226 XXX DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed
227 XXX to resolve a deadlock')
228 XXX
229 XXX I'm told that DBLockDeadlockError is expected at times. It
230 XXX doesn't cause a test to fail when it happens (exceptions in
231 XXX threads are invisible to unittest).
232
233
234_ssl
235 Python wrapper for the secure sockets library.
236
237 Get the latest source code for OpenSSL from
238 http://www.openssl.org
239
240 You (probably) don't want the "engine" code. For example, get
241 openssl-0.9.6g.tar.gz
242 not
243 openssl-engine-0.9.6g.tar.gz
244
245 Unpack into the "dist" directory, retaining the folder name from
246 the archive - for example, the latest stable OpenSSL will install as
247 dist/openssl-0.9.6g
248
249 You can (theoretically) use any version of OpenSSL you like - the
250 build process will automatically select the latest version.
251
252 You must also install ActivePerl from
253 http://www.activestate.com/Products/ActivePerl/
254 as this is used by the OpenSSL build process. Complain to them <wink>.
255
256 The MSVC project simply invokes PCBuild/build_ssl.py to perform
257 the build. This Python script locates and builds your OpenSSL
258 installation, then invokes a simple makefile to build the final .pyd.
259
260 Win9x users: see "Win9x note" below.
261
262 build_ssl.py attempts to catch the most common errors (such as not
263 being able to find OpenSSL sources, or not being able to find a Perl
264 that works with OpenSSL) and give a reasonable error message.
265 If you have a problem that doesn't seem to be handled correctly
266 (eg, you know you have ActivePerl but we can't find it), please take
267 a peek at build_ssl.py and suggest patches. Note that build_ssl.py
268 should be able to be run directly from the command-line.
269
270 build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do
271 this by hand.
272
273 Win9x note: If, near the start of the build process, you see
274 something like
275
276 C:\Code\openssl-0.9.6g>set OPTS=no-asm
277 Out of environment space
278
279 then you're in trouble, and will probably also see these errors near
280 the end of the process:
281
282 NMAKE : fatal error U1073: don't know how to make
283 'crypto\md5\asm\m5_win32.asm'
284 Stop.
285 NMAKE : fatal error U1073: don't know how to make
286 'C:\Code\openssl-0.9.6g/out32/libeay32.lib'
287 Stop.
288
289 You need more environment space. Win9x only has room for 256 bytes
290 by default, and especially after installing ActivePerl (which fiddles
291 the PATH envar), you're likely to run out. KB Q230205
292
293 http://support.microsoft.com/default.aspx?scid=KB;en-us;q230205
294
295 explains how to edit CONFIG.SYS to cure this.
296
297
298YOUR OWN EXTENSION DLLs
299-----------------------
300If you want to create your own extension module DLL, there's an example
301with easy-to-follow instructions in ../PC/example/; read the file
302readme.txt there first.