blob: c1b94af240c944e387b056f83c2e952b5526c4d8 [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
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +000042000 and XP. It requires Microsoft Visual C++ 6.x or 5.x and Platform
5SDK February 2003 Edition (Core SDK). You can download this SDK from
6http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm.
Tim Petersff8505d2004-01-03 05:45:59 +00007(For other Windows platforms and compilers, see ../readme.txt.)
8
9All you need to do is open the workspace "pcbuild.dsw" in MSVC++, select
10the Debug or Release setting (using Build -> Set Active Configuration...),
11and build the projects.
12
13The proper order to build subprojects:
14
151) pythoncore (this builds the main Python DLL and library files,
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +000016 python30.{dll, lib} in Release mode)
Tim Petersff8505d2004-01-03 05:45:59 +000017
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
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +000027their name: python30_d.dll, python_d.exe, pyexpat_d.pyd, and so on.
Tim Petersff8505d2004-01-03 05:45:59 +000028
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
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +000042_msi
43 _msi.c. You need to install Windows Installer SDK to build this module.
Tim Petersff8505d2004-01-03 05:45:59 +000044_socket
45 socketmodule.c
Tim Petersff8505d2004-01-03 05:45:59 +000046_testcapi
47 tests of the Python C API, run via Lib/test/test_capi.py, and
48 implemented by module Modules/_testcapimodule.c
Tim Petersff8505d2004-01-03 05:45:59 +000049pyexpat
50 Python wrapper for accelerated XML parsing, which incorporates stable
51 code from the Expat project: http://sourceforge.net/projects/expat/
52select
53 selectmodule.c
54unicodedata
55 large tables of Unicode data
Tim Petersff8505d2004-01-03 05:45:59 +000056winsound
57 play sounds (typically .wav files) under Windows
58
59The following subprojects will generally NOT build out of the box. They
60wrap code Python doesn't control, and you'll need to download the base
61packages first and unpack them into siblings of PCbuilds's parent
62directory; for example, if your PCbuild is .......\dist\src\PCbuild\,
63unpack into new subdirectories of dist\.
64
65_tkinter
66 Python wrapper for the Tk windowing system. Requires building
Thomas Wouters89f507f2006-12-13 04:49:30 +000067 Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.12.
Tim Petersff8505d2004-01-03 05:45:59 +000068
69 Get source
70 ----------
Thomas Wouters89f507f2006-12-13 04:49:30 +000071 In the dist directory, run
72 svn export http://svn.python.org/projects/external/tcl8.4.12
73 svn export http://svn.python.org/projects/external/tk8.4.12
74 svn export http://svn.python.org/projects/external/tix-8.4.0
Tim Petersff8505d2004-01-03 05:45:59 +000075
Thomas Wouters89f507f2006-12-13 04:49:30 +000076 Build Tcl first (done here w/ MSVC 6 on Win2K)
Tim Petersff8505d2004-01-03 05:45:59 +000077 ---------------
Thomas Wouters89f507f2006-12-13 04:49:30 +000078 cd dist\tcl8.4.12\win
79 run vcvars32.bat
Tim Petersff8505d2004-01-03 05:45:59 +000080 nmake -f makefile.vc
Thomas Wouters89f507f2006-12-13 04:49:30 +000081 nmake -f makefile.vc INSTALLDIR=..\..\tcltk install
Tim Petersff8505d2004-01-03 05:45:59 +000082
83 XXX Should we compile with OPTS=threads?
84
Thomas Wouters89f507f2006-12-13 04:49:30 +000085 Optional: run tests, via
86 nmake -f makefile.vc test
87
88 all.tcl: Total 10835 Passed 10096 Skipped 732 Failed 7
89 Sourced 129 Test Files.
90 Files with failing tests: exec.test expr.test io.test main.test string.test stri
91 ngObj.test
Tim Petersff8505d2004-01-03 05:45:59 +000092
93 Build Tk
94 --------
Thomas Wouters89f507f2006-12-13 04:49:30 +000095 cd dist\tk8.4.12\win
96 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12
97 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 INSTALLDIR=..\..\tcltk install
Tim Petersff8505d2004-01-03 05:45:59 +000098
99 XXX Should we compile with OPTS=threads?
100
101 XXX I have no idea whether "nmake -f makefile.vc test" passed or
102 XXX failed. It popped up tons of little windows, and did lots of
103 XXX stuff, and nothing blew up.
104
Thomas Wouters89f507f2006-12-13 04:49:30 +0000105 Built Tix
106 ---------
107 cd dist\tix-8.4.0\win
108 nmake -f python.mak
109 nmake -f python.mak install
Tim Petersff8505d2004-01-03 05:45:59 +0000110
111bz2
112 Python wrapper for the libbz2 compression library. Homepage
113 http://sources.redhat.com/bzip2/
Thomas Wouters89f507f2006-12-13 04:49:30 +0000114 Download the source from the python.org copy into the dist
115 directory:
Tim Petersff8505d2004-01-03 05:45:59 +0000116
Thomas Wouters89f507f2006-12-13 04:49:30 +0000117 svn export http://svn.python.org/projects/external/bzip2-1.0.3
Tim Petersff8505d2004-01-03 05:45:59 +0000118
Thomas Wouters89f507f2006-12-13 04:49:30 +0000119 And requires building bz2 first.
Tim Petersff8505d2004-01-03 05:45:59 +0000120
Thomas Wouters89f507f2006-12-13 04:49:30 +0000121 cd dist\bzip2-1.0.3
122 nmake -f makefile.msc
123
124 All of this managed to build bzip2-1.0.3\libbz2.lib, which the Python
Tim Petersff8505d2004-01-03 05:45:59 +0000125 project links in.
126
127
128_bsddb
Thomas Wouters89f507f2006-12-13 04:49:30 +0000129 To use the version of bsddb that Python is built with by default, invoke
130 (in the dist directory)
Tim Petersff8505d2004-01-03 05:45:59 +0000131
Thomas Wouters89f507f2006-12-13 04:49:30 +0000132 svn export http://svn.python.org/projects/external/db-4.4.20
Tim Petersff8505d2004-01-03 05:45:59 +0000133
Thomas Wouters89f507f2006-12-13 04:49:30 +0000134 Then open db-4.4.20\build_win32\Berkeley_DB.dsw and build the "db_static"
135 project for "Release" mode.
Tim Petersff8505d2004-01-03 05:45:59 +0000136
Thomas Wouters89f507f2006-12-13 04:49:30 +0000137 Alternatively, if you want to start with the original sources,
138 go to Sleepycat's download page:
139 http://www.sleepycat.com/downloads/releasehistorybdb.html
Tim Petersff8505d2004-01-03 05:45:59 +0000140
Thomas Wouters89f507f2006-12-13 04:49:30 +0000141 and download version 4.4.20.
Tim Petersff8505d2004-01-03 05:45:59 +0000142
Thomas Wouters89f507f2006-12-13 04:49:30 +0000143 With or without strong cryptography? You can choose either with or
144 without strong cryptography, as per the instructions below. By
145 default, Python is built and distributed WITHOUT strong crypto.
Tim Petersff8505d2004-01-03 05:45:59 +0000146
Thomas Wouters89f507f2006-12-13 04:49:30 +0000147 Unpack the sources; if you downloaded the non-crypto version, rename
148 the directory from db-4.4.20.NC to db-4.4.20.
149
150 Now apply any patches that apply to your version.
Tim Petersff8505d2004-01-03 05:45:59 +0000151
152 To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py
153 is then enabled. Running in verbose mode may be helpful.
154
155 XXX The test_bsddb3 tests don't always pass, on Windows (according to
Thomas Wouters89f507f2006-12-13 04:49:30 +0000156 XXX me) or on Linux (according to Barry). (I had much better luck
157 XXX on Win2K than on Win98SE.) The common failure mode across platforms
Tim Petersff8505d2004-01-03 05:45:59 +0000158 XXX is
159 XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable
160 XXX to join the environment')
161 XXX
162 XXX and it appears timing-dependent. On Win2K I also saw this once:
163 XXX
164 XXX test02_SimpleLocks (bsddb.test.test_thread.HashSimpleThreaded) ...
165 XXX Exception in thread reader 1:
166 XXX Traceback (most recent call last):
167 XXX File "C:\Code\python\lib\threading.py", line 411, in __bootstrap
168 XXX self.run()
169 XXX File "C:\Code\python\lib\threading.py", line 399, in run
170 XXX apply(self.__target, self.__args, self.__kwargs)
171 XXX File "C:\Code\python\lib\bsddb\test\test_thread.py", line 268, in
172 XXX readerThread
173 XXX rec = c.next()
174 XXX DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed
175 XXX to resolve a deadlock')
176 XXX
177 XXX I'm told that DBLockDeadlockError is expected at times. It
178 XXX doesn't cause a test to fail when it happens (exceptions in
179 XXX threads are invisible to unittest).
180
181
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +0000182_sqlite3
183 Python wrapper for SQLite library.
184
185 Get the source code through
186
187 svn export http://svn.python.org/projects/external/sqlite-source-3.3.4
188
189 To use the extension module in a Python build tree, copy sqlite3.dll into
190 the PC/VC6 folder.
191
192
Tim Petersff8505d2004-01-03 05:45:59 +0000193_ssl
194 Python wrapper for the secure sockets library.
195
196 Get the latest source code for OpenSSL from
197 http://www.openssl.org
198
199 You (probably) don't want the "engine" code. For example, get
200 openssl-0.9.6g.tar.gz
201 not
202 openssl-engine-0.9.6g.tar.gz
203
204 Unpack into the "dist" directory, retaining the folder name from
205 the archive - for example, the latest stable OpenSSL will install as
206 dist/openssl-0.9.6g
207
208 You can (theoretically) use any version of OpenSSL you like - the
209 build process will automatically select the latest version.
210
211 You must also install ActivePerl from
212 http://www.activestate.com/Products/ActivePerl/
213 as this is used by the OpenSSL build process. Complain to them <wink>.
214
Christian Heimes4c3eda32008-01-04 15:35:04 +0000215 The MSVC project simply invokes PC/VC6/build_ssl.py to perform
Tim Petersff8505d2004-01-03 05:45:59 +0000216 the build. This Python script locates and builds your OpenSSL
217 installation, then invokes a simple makefile to build the final .pyd.
218
Tim Petersff8505d2004-01-03 05:45:59 +0000219 build_ssl.py attempts to catch the most common errors (such as not
220 being able to find OpenSSL sources, or not being able to find a Perl
221 that works with OpenSSL) and give a reasonable error message.
222 If you have a problem that doesn't seem to be handled correctly
223 (eg, you know you have ActivePerl but we can't find it), please take
224 a peek at build_ssl.py and suggest patches. Note that build_ssl.py
225 should be able to be run directly from the command-line.
226
227 build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do
228 this by hand.
229
Tim Petersff8505d2004-01-03 05:45:59 +0000230
231YOUR OWN EXTENSION DLLs
232-----------------------
233If you want to create your own extension module DLL, there's an example
234with easy-to-follow instructions in ../PC/example/; read the file
235readme.txt there first.