blob: b6cd15c3aaa71032e3db10b346890eaf3905c009 [file] [log] [blame]
Tim Peters4b5fb072000-07-01 00:03:43 +00001Building Python using VC++ 6.0 or 5.0
Guido van Rossuma29b3602000-03-29 01:51:37 +00002-------------------------------------
Tim Peters4b5fb072000-07-01 00:03:43 +00003This 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.
Guido van Rossum15b239f1998-05-26 14:16:23 +00005(For other Windows platforms and compilers, see ../PC/readme.txt.)
6
Tim Peters4b5fb072000-07-01 00:03:43 +00007All 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.
Guido van Rossum15b239f1998-05-26 14:16:23 +000010
Tim Petersbefc97c2001-01-18 19:01:39 +000011The proper order to build subprojects:
Guido van Rossum15b239f1998-05-26 14:16:23 +000012
Tim Peters97c96402001-01-17 23:23:13 +0000131) pythoncore (this builds the main Python DLL and library files,
Tim Petersbefc97c2001-01-18 19:01:39 +000014 python21.{dll, lib} in Release mode)
15 NOTE: in previous releases, this subproject was
16 named after the release number, e.g. python20.
Guido van Rossum15b239f1998-05-26 14:16:23 +000017
Tim Petersbefc97c2001-01-18 19:01:39 +0000182) python (this builds the main Python executable,
19 python.exe in Release mode)
Tim Peters4b5fb072000-07-01 00:03:43 +000020
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)
Guido van Rossum15b239f1998-05-26 14:16:23 +000025
26When using the Debug setting, the output files have a _d added to
Tim Peters97c96402001-01-17 23:23:13 +000027their name: python21_d.dll, python_d.exe, parser_d.pyd, and so on.
Guido van Rossume79cf321998-07-07 22:35:03 +000028
Tim Peters4b5fb072000-07-01 00:03:43 +000029SUBPROJECTS
30-----------
Tim Peters610a8272000-07-01 02:51:23 +000031These subprojects should build out of the box. Subprojects other than the
Tim Petersbefc97c2001-01-18 19:01:39 +000032main ones (pythoncore, python, pythonw) generally build a DLL (renamed to
Tim Peters610a8272000-07-01 02:51:23 +000033.pyd) from a specific module so that users don't have to load the code
Tim Peters4b5fb072000-07-01 00:03:43 +000034supporting that module unless they import the module.
Guido van Rossume79cf321998-07-07 22:35:03 +000035
Tim Peters97c96402001-01-17 23:23:13 +000036pythoncore
Tim Peters4b5fb072000-07-01 00:03:43 +000037 .dll and .lib
38python
39 .exe
40pythonw
41 pythonw.exe, a variant of python.exe that doesn't pop up a DOS box
42_socket
43 socketmodule.c
44_sre
45 Unicode-aware regular expression engine
Tim Petersb16c56f2001-02-02 21:24:51 +000046_symtable
47 the _symtable module, symtablemodule.c
Tim Petersd66595f2001-02-04 03:09:53 +000048_testcapi
Tim Petersb16c56f2001-02-02 21:24:51 +000049 tests of the Python C API, run via Lib/test/test_capi.py, and
Tim Petersd66595f2001-02-04 03:09:53 +000050 implemented by module Modules/_testcapimodule.c
Tim Peters2a799bf2002-12-16 20:18:38 +000051datetime
52 datetimemodule.c
Tim Peters4b5fb072000-07-01 00:03:43 +000053mmap
54 mmapmodule.c
55parser
56 the parser module
Tim Petersb012a152002-02-13 23:56:46 +000057pyexpat
58 Python wrapper for accelerated XML parsing, which incorporates stable
59 code from the Expat project: http://sourceforge.net/projects/expat/
Tim Peters4b5fb072000-07-01 00:03:43 +000060select
61 selectmodule.c
Tim Peters19f52c22001-01-24 10:07:22 +000062unicodedata
Tim Peters4b5fb072000-07-01 00:03:43 +000063 large tables of Unicode data
64winreg
65 Windows registry API
66winsound
67 play sounds (typically .wav files) under Windows
68
69The following subprojects will generally NOT build out of the box. They
70wrap code Python doesn't control, and you'll need to download the base
Tim Petersaff12842000-08-25 06:52:44 +000071packages first and unpack them into siblings of PCbuilds's parent
72directory; for example, if your PCbuild is .......\dist\src\PCbuild\,
73unpack into new subdirectories of dist\.
Tim Peters4b5fb072000-07-01 00:03:43 +000074
75_tkinter
Tim Peters077736b2002-11-14 23:24:40 +000076 Python wrapper for the Tk windowing system. Requires building
77 Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.1:
78
79 Get source
80 ----------
81 Go to
82 http://prdownloads.sourceforge.net/tcl/
83 and download
84 tcl841-src.zip
85 tk841-src.zip
86 Unzip into
87 dist\tcl8.4.1\
Tim Peters6c629952002-11-15 18:36:11 +000088 dist\tk8.4.1\
Tim Peters077736b2002-11-14 23:24:40 +000089 respectively.
90
Tim Peters6c629952002-11-15 18:36:11 +000091 Build Tcl first (done here w/ MSVC 6 on Win2K; also Win98SE)
92 ---------------
Tim Peters077736b2002-11-14 23:24:40 +000093 cd dist\tcl8.4.1\win
94 run vcvars32.bat [necessary even on Win2K]
95 nmake -f makefile.vc
96 nmake -f makefile.vc INSTALLDIR=..\..\tcl84 install
97
98 XXX Should we compile with OPTS=threads?
99
100 XXX Some tests failed in "nmake -f makefile.vc test".
101
Tim Peters077736b2002-11-14 23:24:40 +0000102 Build Tk
Tim Peters6c629952002-11-15 18:36:11 +0000103 --------
Tim Peters077736b2002-11-14 23:24:40 +0000104 cd dist\tk8.4.1\win
105 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1
106 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 INSTALLDIR=..\..\tcl84 install
107
108 XXX Should we compile with OPTS=threads?
109
110 XXX Some tests failed in "nmake -f makefile.vc test".
111
112 XXX Our installer copies a lot of stuff out of the Tcl/Tk install
113 XXX directory. Is all of that really needed for Python use of Tcl/Tk?
114
Tim Petersa406b582002-11-19 17:38:27 +0000115 Make sure the installer matches
116 -------------------------------
117 Ensure that the Wise compiler vrbl _TCLDIR_ is set to the name of
118 the common Tcl/Tk installation directory (tcl84 for the instructions
119 above). This is needed so the installer can copy various Tcl/Tk
120 files into the Python distribution.
121
Tim Peters4b5fb072000-07-01 00:03:43 +0000122
123zlib
Tim Petersee826f82001-01-31 19:39:44 +0000124 Python wrapper for the zlib compression library. Get the source code
Tim Peters6077f642002-03-13 21:51:55 +0000125 for version 1.1.4 from a convenient mirror at:
126 http://www.gzip.org/zlib/
127 Unpack into dist\zlib-1.1.4.
Tim Petersee826f82001-01-31 19:39:44 +0000128 A custom pre-link step in the zlib project settings should manage to
Tim Peters6077f642002-03-13 21:51:55 +0000129 build zlib-1.1.4\zlib.lib by magic before zlib.pyd (or zlib_d.pyd) is
Tim Petersee826f82001-01-31 19:39:44 +0000130 linked in PCbuild\.
131 However, the zlib project is not smart enough to remove anything under
Tim Peters6077f642002-03-13 21:51:55 +0000132 zlib-1.1.4\ when you do a clean, so if you want to rebuild zlib.lib
133 you need to clean up zlib-1.1.4\ by hand.
Tim Peters4b5fb072000-07-01 00:03:43 +0000134
Tim Petersb0ead4e2002-11-09 04:48:58 +0000135bz2
136 Python wrapper for the libbz2 compression library. Homepage
137 http://sources.redhat.com/bzip2/
138 Download the source tarball, bzip2-1.0.2.tar.gz.
Tim Peters077736b2002-11-14 23:24:40 +0000139 Unpack into dist\bzip2-1.0.2. WARNING: If you're using WinZip, you
Tim Petersb0ead4e2002-11-09 04:48:58 +0000140 must disable its "TAR file smart CR/LF conversion" feature (under
141 Options -> Configuration -> Miscellaneous -> Other) for the duration.
Tim Peters077736b2002-11-14 23:24:40 +0000142
Tim Petersb0ead4e2002-11-09 04:48:58 +0000143 Don't bother trying to use libbz2.dsp with MSVC. After 10 minutes
144 of fiddling, I couldn't get it to work. Perhaps it works with
145 MSVC 5 (I used MSVC 6). It's better to run the by-hand makefile
Tim Peters077736b2002-11-14 23:24:40 +0000146 anyway, because it runs a helpful test step at the end.
147
Tim Petersb0ead4e2002-11-09 04:48:58 +0000148 cd into dist\bzip2-1.0.2, and run
149 nmake -f makefile.msc
150 [Note that if you're running Win9X, you'll need to run vcvars32.bat
151 before running nmake (this batch file is in your MSVC installation).
152 TODO: make this work like zlib (in particular, MSVC runs the prelink
153 step in an enviroment that already has the correct envars set up).
154 ]
Tim Peters077736b2002-11-14 23:24:40 +0000155 The make step shouldn't yield any warnings or errors, and should end
Tim Petersb0ead4e2002-11-09 04:48:58 +0000156 by displaying 6 blocks each terminated with
157 FC: no differences encountered
158 If FC finds differences, see the warning abou WinZip above (when I
159 first tried it, sample3.ref failed due to CRLF conversion).
Tim Peters077736b2002-11-14 23:24:40 +0000160
Tim Petersb0ead4e2002-11-09 04:48:58 +0000161 All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python
162 project links in.
163
164
Tim Peters78e35f92002-11-22 20:00:34 +0000165_bsddb
Tim Peters84c7a3f2002-11-23 18:48:06 +0000166 XXX The Sleepycat release we use will probably change before
167 XXX 2.3a1.
Tim Peters78e35f92002-11-22 20:00:34 +0000168 Go to Sleepycat's patches page:
169 http://www.sleepycat.com/update/index.html
170 and download
171 4.0.14.zip
172 from the download page. The file name is db-4.0.14.zip. Unpack into
173 dist\db-4.0.14
Tim Petersb0ead4e2002-11-09 04:48:58 +0000174
Tim Peters78e35f92002-11-22 20:00:34 +0000175 Apply the patch file bsddb_patch.txt in this (PCbuild) directory
176 against the file
177 dist\db-4.0.14\db\db_reclaim.c
178
179 Go to
180 http://www.sleepycat.com/docs/ref/build_win/intro.html
181 and follow the instructions for building the Sleepycat software.
182 Build the Release version.
Tim Peters19cf4ee2002-11-23 03:49:08 +0000183 NOTE: The instructions are for a later release of the software,
184 so use your imagination. Berkeley_DB.dsw in this release was
185 also pre-MSVC6, so you'll be prompted to upgrade the format (say
186 yes, of course). Choose configuration "db_buildall - Win32 Release",
187 and build db_buildall.exe.
Tim Peters78e35f92002-11-22 20:00:34 +0000188
Tim Peters84c7a3f2002-11-23 18:48:06 +0000189 XXX We're actually linking against Release_static\libdb40s.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.
Tim Peters78e35f92002-11-22 20:00:34 +0000203
Tim Peterse8bcb252002-12-04 02:39:52 +0000204
Mark Hammondf229f9f2002-12-03 05:47:26 +0000205_ssl
Tim Peterse8bcb252002-12-04 02:39:52 +0000206 Python wrapper for the secure sockets library.
Tim Peters4b5fb072000-07-01 00:03:43 +0000207
Mark Hammondf229f9f2002-12-03 05:47:26 +0000208 Get the latest source code for OpenSSL from
209 http://www.openssl.org
210
Tim Peterse8bcb252002-12-04 02:39:52 +0000211 You (probably) don't want the "engine" code. For example, get
212 openssl-0.9.6g.tar.gz
213 not
214 openssl-engine-0.9.6g.tar.gz
215
Mark Hammondf229f9f2002-12-03 05:47:26 +0000216 Unpack into the "dist" directory, retaining the folder name from
217 the archive - for example, the latest stable OpenSSL will install as
218 dist/openssl-0.9.6g
219
220 You can (theoretically) use any version of OpenSSL you like - the
221 build process will automatically select the latest version.
222
223 You must also install ActivePerl from
224 http://www.activestate.com/Products/ActivePerl/
Tim Peterse8bcb252002-12-04 02:39:52 +0000225 as this is used by the OpenSSL build process. Complain to them <wink>.
Mark Hammondf229f9f2002-12-03 05:47:26 +0000226
227 The MSVC project simply invokes PCBuild/build_ssl.py to perform
Tim Peterse8bcb252002-12-04 02:39:52 +0000228 the build. This Python script locates and builds your OpenSSL
Mark Hammondf229f9f2002-12-03 05:47:26 +0000229 installation, then invokes a simple makefile to build the final .pyd.
230
Tim Peters6ee68d22002-12-04 03:16:37 +0000231 Win9x users: see "Win9x note" below.
232
Mark Hammondf229f9f2002-12-03 05:47:26 +0000233 build_ssl.py attempts to catch the most common errors (such as not
234 being able to find OpenSSL sources, or not being able to find a Perl
235 that works with OpenSSL) and give a reasonable error message.
236 If you have a problem that doesn't seem to be handled correctly
237 (eg, you know you have ActivePerl but we can't find it), please take
238 a peek at build_ssl.py and suggest patches. Note that build_ssl.py
239 should be able to be run directly from the command-line.
240
Tim Peterse8bcb252002-12-04 02:39:52 +0000241 build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do
242 this by hand.
Tim Peters4b5fb072000-07-01 00:03:43 +0000243
Tim Peters6ee68d22002-12-04 03:16:37 +0000244 Win9x note: If, near the start of the build process, you see
245 something like
246
247 C:\Code\openssl-0.9.6g>set OPTS=no-asm
248 Out of environment space
249
Tim Peters21d77f52002-12-04 04:00:12 +0000250 then you're in trouble, and will probably also see these errors near
Tim Peters6ee68d22002-12-04 03:16:37 +0000251 the end of the process:
252
253 NMAKE : fatal error U1073: don't know how to make
254 'crypto\md5\asm\m5_win32.asm'
255 Stop.
256 NMAKE : fatal error U1073: don't know how to make
257 'C:\Code\openssl-0.9.6g/out32/libeay32.lib'
258 Stop.
259
260 You need more environment space. Win9x only has room for 256 bytes
261 by default, and especially after installing ActivePerl (which fiddles
262 the PATH envar), you're likely to run out. KB Q230205
263
264 http://support.microsoft.com/default.aspx?scid=KB;en-us;q230205
265
266 explains how to edit CONFIG.SYS to cure this.
267
268
Tim Petersf9a4a6e2000-07-01 20:38:27 +0000269YOUR OWN EXTENSION DLLs
Tim Peters4b5fb072000-07-01 00:03:43 +0000270-----------------------
271If you want to create your own extension module DLL, there's an example
272with easy-to-follow instructions in ../PC/example/; read the file
273readme.txt there first.