Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 1 | Building Python using VC++ 6.0 or 5.0 |
| 2 | ------------------------------------- |
| 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. |
| 5 | (For other Windows platforms and compilers, see ../readme.txt.) |
| 6 | |
| 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. |
| 10 | |
| 11 | The proper order to build subprojects: |
| 12 | |
| 13 | 1) 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 | |
| 18 | 2) python (this builds the main Python executable, |
| 19 | python.exe in Release mode) |
| 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) |
| 25 | |
| 26 | When using the Debug setting, the output files have a _d added to |
| 27 | their name: python21_d.dll, python_d.exe, parser_d.pyd, and so on. |
| 28 | |
| 29 | SUBPROJECTS |
| 30 | ----------- |
| 31 | These subprojects should build out of the box. Subprojects other than the |
| 32 | main 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 |
| 34 | supporting that module unless they import the module. |
| 35 | |
| 36 | pythoncore |
| 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 |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 42 | _socket |
| 43 | socketmodule.c |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 44 | _testcapi |
| 45 | tests of the Python C API, run via Lib/test/test_capi.py, and |
| 46 | implemented by module Modules/_testcapimodule.c |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 47 | pyexpat |
| 48 | Python wrapper for accelerated XML parsing, which incorporates stable |
| 49 | code from the Expat project: http://sourceforge.net/projects/expat/ |
| 50 | select |
| 51 | selectmodule.c |
| 52 | unicodedata |
| 53 | large tables of Unicode data |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 54 | winsound |
| 55 | play sounds (typically .wav files) under Windows |
| 56 | |
| 57 | The following subprojects will generally NOT build out of the box. They |
| 58 | wrap code Python doesn't control, and you'll need to download the base |
| 59 | packages first and unpack them into siblings of PCbuilds's parent |
| 60 | directory; for example, if your PCbuild is .......\dist\src\PCbuild\, |
| 61 | unpack into new subdirectories of dist\. |
| 62 | |
| 63 | _tkinter |
| 64 | Python wrapper for the Tk windowing system. Requires building |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 65 | Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.12. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 66 | |
| 67 | Get source |
| 68 | ---------- |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 69 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 73 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 74 | Build Tcl first (done here w/ MSVC 6 on Win2K) |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 75 | --------------- |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 76 | cd dist\tcl8.4.12\win |
| 77 | run vcvars32.bat |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 78 | nmake -f makefile.vc |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 79 | nmake -f makefile.vc INSTALLDIR=..\..\tcltk install |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 80 | |
| 81 | XXX Should we compile with OPTS=threads? |
| 82 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 83 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 90 | |
| 91 | Build Tk |
| 92 | -------- |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 93 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 96 | |
| 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 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 103 | Built Tix |
| 104 | --------- |
| 105 | cd dist\tix-8.4.0\win |
| 106 | nmake -f python.mak |
| 107 | nmake -f python.mak install |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 108 | |
| 109 | bz2 |
| 110 | Python wrapper for the libbz2 compression library. Homepage |
| 111 | http://sources.redhat.com/bzip2/ |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 112 | Download the source from the python.org copy into the dist |
| 113 | directory: |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 114 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 115 | svn export http://svn.python.org/projects/external/bzip2-1.0.3 |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 116 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 117 | And requires building bz2 first. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 118 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 119 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 123 | project links in. |
| 124 | |
| 125 | |
| 126 | _bsddb |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 127 | To use the version of bsddb that Python is built with by default, invoke |
| 128 | (in the dist directory) |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 129 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 130 | svn export http://svn.python.org/projects/external/db-4.4.20 |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 131 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 132 | Then open db-4.4.20\build_win32\Berkeley_DB.dsw and build the "db_static" |
| 133 | project for "Release" mode. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 134 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 135 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 138 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 139 | and download version 4.4.20. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 140 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 141 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 144 | |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 145 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 149 | |
| 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 |
Martin v. Löwis | 7addebf | 2006-10-17 15:18:06 +0000 | [diff] [blame] | 154 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 156 | 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 | |
| 202 | The MSVC project simply invokes PCBuild/build_ssl.py to perform |
| 203 | the build. This Python script locates and builds your OpenSSL |
| 204 | installation, then invokes a simple makefile to build the final .pyd. |
| 205 | |
| 206 | Win9x users: see "Win9x note" below. |
| 207 | |
| 208 | build_ssl.py attempts to catch the most common errors (such as not |
| 209 | being able to find OpenSSL sources, or not being able to find a Perl |
| 210 | that works with OpenSSL) and give a reasonable error message. |
| 211 | If you have a problem that doesn't seem to be handled correctly |
| 212 | (eg, you know you have ActivePerl but we can't find it), please take |
| 213 | a peek at build_ssl.py and suggest patches. Note that build_ssl.py |
| 214 | should be able to be run directly from the command-line. |
| 215 | |
| 216 | build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do |
| 217 | this by hand. |
| 218 | |
| 219 | Win9x note: If, near the start of the build process, you see |
| 220 | something like |
| 221 | |
| 222 | C:\Code\openssl-0.9.6g>set OPTS=no-asm |
| 223 | Out of environment space |
| 224 | |
| 225 | then you're in trouble, and will probably also see these errors near |
| 226 | the end of the process: |
| 227 | |
| 228 | NMAKE : fatal error U1073: don't know how to make |
| 229 | 'crypto\md5\asm\m5_win32.asm' |
| 230 | Stop. |
| 231 | NMAKE : fatal error U1073: don't know how to make |
| 232 | 'C:\Code\openssl-0.9.6g/out32/libeay32.lib' |
| 233 | Stop. |
| 234 | |
| 235 | You need more environment space. Win9x only has room for 256 bytes |
| 236 | by default, and especially after installing ActivePerl (which fiddles |
| 237 | the PATH envar), you're likely to run out. KB Q230205 |
| 238 | |
| 239 | http://support.microsoft.com/default.aspx?scid=KB;en-us;q230205 |
| 240 | |
| 241 | explains how to edit CONFIG.SYS to cure this. |
| 242 | |
| 243 | |
| 244 | YOUR OWN EXTENSION DLLs |
| 245 | ----------------------- |
| 246 | If you want to create your own extension module DLL, there's an example |
| 247 | with easy-to-follow instructions in ../PC/example/; read the file |
| 248 | readme.txt there first. |