Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 1 | Building Python using VC++ 6.0 or 5.0 |
Guido van Rossum | a29b360 | 2000-03-29 01:51:37 +0000 | [diff] [blame] | 2 | ------------------------------------- |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 3 | This directory is used to build Python for Win32 platforms, e.g. Windows |
| 4 | 95, 98 and NT. It requires Microsoft Visual C++ 6.x or 5.x. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 5 | (For other Windows platforms and compilers, see ../PC/readme.txt.) |
| 6 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 7 | All you need to do is open the workspace "pcbuild.dsw" in MSVC++, select |
| 8 | the Debug or Release setting (using Build -> Set Active Configuration...), |
| 9 | and build the projects. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 10 | |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 11 | The proper order to build subprojects: |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 12 | |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 13 | 1) pythoncore (this builds the main Python DLL and library files, |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 14 | 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 Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 17 | |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 18 | 2) python (this builds the main Python executable, |
| 19 | python.exe in Release mode) |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 20 | |
| 21 | 3) 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 Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 25 | |
| 26 | When using the Debug setting, the output files have a _d added to |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 27 | their name: python21_d.dll, python_d.exe, parser_d.pyd, and so on. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 28 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 29 | SUBPROJECTS |
| 30 | ----------- |
Tim Peters | 610a827 | 2000-07-01 02:51:23 +0000 | [diff] [blame] | 31 | These subprojects should build out of the box. Subprojects other than the |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 32 | main ones (pythoncore, python, pythonw) generally build a DLL (renamed to |
Tim Peters | 610a827 | 2000-07-01 02:51:23 +0000 | [diff] [blame] | 33 | .pyd) from a specific module so that users don't have to load the code |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 34 | supporting that module unless they import the module. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 35 | |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 36 | pythoncore |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 37 | .dll and .lib |
| 38 | python |
| 39 | .exe |
| 40 | pythonw |
| 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 Peters | b16c56f | 2001-02-02 21:24:51 +0000 | [diff] [blame] | 46 | _symtable |
| 47 | the _symtable module, symtablemodule.c |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 48 | _testcapi |
Tim Peters | b16c56f | 2001-02-02 21:24:51 +0000 | [diff] [blame] | 49 | tests of the Python C API, run via Lib/test/test_capi.py, and |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 50 | implemented by module Modules/_testcapimodule.c |
Tim Peters | 2a799bf | 2002-12-16 20:18:38 +0000 | [diff] [blame] | 51 | datetime |
| 52 | datetimemodule.c |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 53 | mmap |
| 54 | mmapmodule.c |
| 55 | parser |
| 56 | the parser module |
Tim Peters | b012a15 | 2002-02-13 23:56:46 +0000 | [diff] [blame] | 57 | pyexpat |
| 58 | Python wrapper for accelerated XML parsing, which incorporates stable |
| 59 | code from the Expat project: http://sourceforge.net/projects/expat/ |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 60 | select |
| 61 | selectmodule.c |
Tim Peters | 19f52c2 | 2001-01-24 10:07:22 +0000 | [diff] [blame] | 62 | unicodedata |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 63 | large tables of Unicode data |
| 64 | winreg |
| 65 | Windows registry API |
| 66 | winsound |
| 67 | play sounds (typically .wav files) under Windows |
| 68 | |
| 69 | The following subprojects will generally NOT build out of the box. They |
| 70 | wrap code Python doesn't control, and you'll need to download the base |
Tim Peters | aff1284 | 2000-08-25 06:52:44 +0000 | [diff] [blame] | 71 | packages first and unpack them into siblings of PCbuilds's parent |
| 72 | directory; for example, if your PCbuild is .......\dist\src\PCbuild\, |
| 73 | unpack into new subdirectories of dist\. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 74 | |
| 75 | _tkinter |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 76 | 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 Peters | 6c62995 | 2002-11-15 18:36:11 +0000 | [diff] [blame] | 88 | dist\tk8.4.1\ |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 89 | respectively. |
| 90 | |
Tim Peters | 6c62995 | 2002-11-15 18:36:11 +0000 | [diff] [blame] | 91 | Build Tcl first (done here w/ MSVC 6 on Win2K; also Win98SE) |
| 92 | --------------- |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 93 | 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 Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 102 | Build Tk |
Tim Peters | 6c62995 | 2002-11-15 18:36:11 +0000 | [diff] [blame] | 103 | -------- |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 104 | 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 Peters | a406b58 | 2002-11-19 17:38:27 +0000 | [diff] [blame] | 115 | 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 Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 122 | |
| 123 | zlib |
Tim Peters | ee826f8 | 2001-01-31 19:39:44 +0000 | [diff] [blame] | 124 | Python wrapper for the zlib compression library. Get the source code |
Tim Peters | 6077f64 | 2002-03-13 21:51:55 +0000 | [diff] [blame] | 125 | 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 Peters | ee826f8 | 2001-01-31 19:39:44 +0000 | [diff] [blame] | 128 | A custom pre-link step in the zlib project settings should manage to |
Tim Peters | 6077f64 | 2002-03-13 21:51:55 +0000 | [diff] [blame] | 129 | build zlib-1.1.4\zlib.lib by magic before zlib.pyd (or zlib_d.pyd) is |
Tim Peters | ee826f8 | 2001-01-31 19:39:44 +0000 | [diff] [blame] | 130 | linked in PCbuild\. |
| 131 | However, the zlib project is not smart enough to remove anything under |
Tim Peters | 6077f64 | 2002-03-13 21:51:55 +0000 | [diff] [blame] | 132 | 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 Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 134 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 135 | bz2 |
| 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 Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 139 | Unpack into dist\bzip2-1.0.2. WARNING: If you're using WinZip, you |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 140 | must disable its "TAR file smart CR/LF conversion" feature (under |
| 141 | Options -> Configuration -> Miscellaneous -> Other) for the duration. |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 142 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 143 | 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 Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 146 | anyway, because it runs a helpful test step at the end. |
| 147 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 148 | 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 Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 155 | The make step shouldn't yield any warnings or errors, and should end |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 156 | 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 Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 160 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 161 | All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python |
| 162 | project links in. |
| 163 | |
| 164 | |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 165 | _bsddb |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 166 | Go to Sleepycat's download page: |
| 167 | http://www.sleepycat.com/download/ |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 168 | |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 169 | and download version 4.1.25. The file name is db-4.1.25.NC.zip. |
| 170 | XXX with or without strong cryptography? I picked "without". |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 171 | |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 172 | Unpack into |
| 173 | dist\db-4.1.25 |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 174 | |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 175 | [If using WinZip to unpack the db-4.1.25.NC distro, that requires |
| 176 | renaming the directory (to remove ".NC") after unpacking. |
| 177 | ] |
| 178 | |
| 179 | Open |
| 180 | dist\db-4.1.25\docs\index.html |
| 181 | |
| 182 | and follow the Windows instructions for building the Sleepycat |
| 183 | software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory. |
| 184 | Build the Release version ("build_all -- Win32 Release"). |
| 185 | |
| 186 | XXX We're actually linking against Release_static\libdb41s.lib. |
Tim Peters | 84c7a3f | 2002-11-23 18:48:06 +0000 | [diff] [blame] | 187 | XXX This yields the following warnings: |
| 188 | """ |
| 189 | Compiling... |
| 190 | _bsddb.c |
| 191 | Linking... |
| 192 | Creating library ./_bsddb.lib and object ./_bsddb.exp |
| 193 | LINK : warning LNK4049: locally defined symbol "_malloc" imported |
| 194 | LINK : warning LNK4049: locally defined symbol "_free" imported |
| 195 | LINK : warning LNK4049: locally defined symbol "_fclose" imported |
| 196 | LINK : warning LNK4049: locally defined symbol "_fopen" imported |
| 197 | _bsddb.pyd - 0 error(s), 4 warning(s) |
| 198 | """ |
| 199 | XXX This isn't encouraging, but I don't know what to do about it. |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 200 | |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 201 | To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py |
| 202 | is then enabled. Running in verbose mode may be helpful. |
| 203 | |
| 204 | XXX The test_bsddb3 tests don't always pass, on Windows (according to |
| 205 | XXX me) or on Linux (according to Barry). I had much better luck |
| 206 | XXX on Win2K than on Win98SE. The common failure mode across platforms |
| 207 | XXX is |
| 208 | XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable |
| 209 | XXX to join the environment') |
| 210 | XXX |
| 211 | XXX and it appears timing-dependent. On Win2K I also saw this once: |
| 212 | XXX |
| 213 | XXX test02_SimpleLocks (bsddb.test.test_thread.HashSimpleThreaded) ... |
| 214 | XXX Exception in thread reader 1: |
| 215 | XXX Traceback (most recent call last): |
| 216 | XXX File "C:\Code\python\lib\threading.py", line 411, in __bootstrap |
| 217 | XXX self.run() |
| 218 | XXX File "C:\Code\python\lib\threading.py", line 399, in run |
| 219 | XXX apply(self.__target, self.__args, self.__kwargs) |
| 220 | XXX File "C:\Code\python\lib\bsddb\test\test_thread.py", line 268, in |
| 221 | XXX readerThread |
| 222 | XXX rec = c.next() |
| 223 | XXX DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed |
| 224 | XXX to resolve a deadlock') |
| 225 | |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 226 | |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 227 | _ssl |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 228 | Python wrapper for the secure sockets library. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 229 | |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 230 | Get the latest source code for OpenSSL from |
| 231 | http://www.openssl.org |
| 232 | |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 233 | You (probably) don't want the "engine" code. For example, get |
| 234 | openssl-0.9.6g.tar.gz |
| 235 | not |
| 236 | openssl-engine-0.9.6g.tar.gz |
| 237 | |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 238 | Unpack into the "dist" directory, retaining the folder name from |
| 239 | the archive - for example, the latest stable OpenSSL will install as |
| 240 | dist/openssl-0.9.6g |
| 241 | |
| 242 | You can (theoretically) use any version of OpenSSL you like - the |
| 243 | build process will automatically select the latest version. |
| 244 | |
| 245 | You must also install ActivePerl from |
| 246 | http://www.activestate.com/Products/ActivePerl/ |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 247 | as this is used by the OpenSSL build process. Complain to them <wink>. |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 248 | |
| 249 | The MSVC project simply invokes PCBuild/build_ssl.py to perform |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 250 | the build. This Python script locates and builds your OpenSSL |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 251 | installation, then invokes a simple makefile to build the final .pyd. |
| 252 | |
Tim Peters | 6ee68d2 | 2002-12-04 03:16:37 +0000 | [diff] [blame] | 253 | Win9x users: see "Win9x note" below. |
| 254 | |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 255 | build_ssl.py attempts to catch the most common errors (such as not |
| 256 | being able to find OpenSSL sources, or not being able to find a Perl |
| 257 | that works with OpenSSL) and give a reasonable error message. |
| 258 | If you have a problem that doesn't seem to be handled correctly |
| 259 | (eg, you know you have ActivePerl but we can't find it), please take |
| 260 | a peek at build_ssl.py and suggest patches. Note that build_ssl.py |
| 261 | should be able to be run directly from the command-line. |
| 262 | |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 263 | build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do |
| 264 | this by hand. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 265 | |
Tim Peters | 6ee68d2 | 2002-12-04 03:16:37 +0000 | [diff] [blame] | 266 | Win9x note: If, near the start of the build process, you see |
| 267 | something like |
| 268 | |
| 269 | C:\Code\openssl-0.9.6g>set OPTS=no-asm |
| 270 | Out of environment space |
| 271 | |
Tim Peters | 21d77f5 | 2002-12-04 04:00:12 +0000 | [diff] [blame] | 272 | then you're in trouble, and will probably also see these errors near |
Tim Peters | 6ee68d2 | 2002-12-04 03:16:37 +0000 | [diff] [blame] | 273 | the end of the process: |
| 274 | |
| 275 | NMAKE : fatal error U1073: don't know how to make |
| 276 | 'crypto\md5\asm\m5_win32.asm' |
| 277 | Stop. |
| 278 | NMAKE : fatal error U1073: don't know how to make |
| 279 | 'C:\Code\openssl-0.9.6g/out32/libeay32.lib' |
| 280 | Stop. |
| 281 | |
| 282 | You need more environment space. Win9x only has room for 256 bytes |
| 283 | by default, and especially after installing ActivePerl (which fiddles |
| 284 | the PATH envar), you're likely to run out. KB Q230205 |
| 285 | |
| 286 | http://support.microsoft.com/default.aspx?scid=KB;en-us;q230205 |
| 287 | |
| 288 | explains how to edit CONFIG.SYS to cure this. |
| 289 | |
| 290 | |
Tim Peters | f9a4a6e | 2000-07-01 20:38:27 +0000 | [diff] [blame] | 291 | YOUR OWN EXTENSION DLLs |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 292 | ----------------------- |
| 293 | If you want to create your own extension module DLL, there's an example |
| 294 | with easy-to-follow instructions in ../PC/example/; read the file |
| 295 | readme.txt there first. |