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 |
Hirokazu Yamamoto | 0255f0e | 2008-08-14 01:40:45 +0000 | [diff] [blame] | 4 | 2000 and XP. It requires Microsoft Visual C++ 6.x or 5.x and Platform |
| 5 | SDK February 2003 Edition (Core SDK). You can download this SDK from |
| 6 | http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 7 | (For other Windows platforms and compilers, see ../readme.txt.) |
| 8 | |
| 9 | All you need to do is open the workspace "pcbuild.dsw" in MSVC++, select |
| 10 | the Debug or Release setting (using Build -> Set Active Configuration...), |
| 11 | and build the projects. |
| 12 | |
| 13 | The proper order to build subprojects: |
| 14 | |
| 15 | 1) pythoncore (this builds the main Python DLL and library files, |
Hirokazu Yamamoto | 0255f0e | 2008-08-14 01:40:45 +0000 | [diff] [blame] | 16 | python30.{dll, lib} in Release mode) |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 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 |
Hirokazu Yamamoto | 0255f0e | 2008-08-14 01:40:45 +0000 | [diff] [blame] | 27 | their name: python30_d.dll, python_d.exe, pyexpat_d.pyd, and so on. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 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 |
Hirokazu Yamamoto | 0255f0e | 2008-08-14 01:40:45 +0000 | [diff] [blame] | 42 | _msi |
| 43 | _msi.c. You need to install Windows Installer SDK to build this module. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 44 | _socket |
| 45 | socketmodule.c |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 46 | _testcapi |
| 47 | tests of the Python C API, run via Lib/test/test_capi.py, and |
| 48 | implemented by module Modules/_testcapimodule.c |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 49 | pyexpat |
| 50 | Python wrapper for accelerated XML parsing, which incorporates stable |
| 51 | code from the Expat project: http://sourceforge.net/projects/expat/ |
| 52 | select |
| 53 | selectmodule.c |
| 54 | unicodedata |
| 55 | large tables of Unicode data |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 56 | winsound |
| 57 | play sounds (typically .wav files) under Windows |
| 58 | |
| 59 | The following subprojects will generally NOT build out of the box. They |
| 60 | wrap code Python doesn't control, and you'll need to download the base |
| 61 | packages first and unpack them into siblings of PCbuilds's parent |
| 62 | directory; for example, if your PCbuild is .......\dist\src\PCbuild\, |
| 63 | unpack into new subdirectories of dist\. |
| 64 | |
| 65 | _tkinter |
| 66 | Python wrapper for the Tk windowing system. Requires building |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 67 | Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.12. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 68 | |
| 69 | Get source |
| 70 | ---------- |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 71 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 75 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 76 | Build Tcl first (done here w/ MSVC 6 on Win2K) |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 77 | --------------- |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 78 | cd dist\tcl8.4.12\win |
| 79 | run vcvars32.bat |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 80 | nmake -f makefile.vc |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 81 | nmake -f makefile.vc INSTALLDIR=..\..\tcltk install |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 82 | |
| 83 | XXX Should we compile with OPTS=threads? |
| 84 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 85 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 92 | |
| 93 | Build Tk |
| 94 | -------- |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 95 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 98 | |
| 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 Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 105 | Built Tix |
| 106 | --------- |
| 107 | cd dist\tix-8.4.0\win |
| 108 | nmake -f python.mak |
| 109 | nmake -f python.mak install |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 110 | |
| 111 | bz2 |
| 112 | Python wrapper for the libbz2 compression library. Homepage |
| 113 | http://sources.redhat.com/bzip2/ |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 114 | Download the source from the python.org copy into the dist |
| 115 | directory: |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 116 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 117 | svn export http://svn.python.org/projects/external/bzip2-1.0.3 |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 118 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 119 | And requires building bz2 first. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 120 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 121 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 125 | project links in. |
| 126 | |
| 127 | |
| 128 | _bsddb |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 129 | To use the version of bsddb that Python is built with by default, invoke |
| 130 | (in the dist directory) |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 131 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 132 | svn export http://svn.python.org/projects/external/db-4.4.20 |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 133 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 134 | Then open db-4.4.20\build_win32\Berkeley_DB.dsw and build the "db_static" |
| 135 | project for "Release" mode. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 136 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 137 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 140 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 141 | and download version 4.4.20. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 142 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 143 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 146 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 147 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 151 | |
| 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 Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 156 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 158 | 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 Yamamoto | 0255f0e | 2008-08-14 01:40:45 +0000 | [diff] [blame] | 182 | _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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 193 | _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 Heimes | 4c3eda3 | 2008-01-04 15:35:04 +0000 | [diff] [blame] | 215 | The MSVC project simply invokes PC/VC6/build_ssl.py to perform |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 216 | the build. This Python script locates and builds your OpenSSL |
| 217 | installation, then invokes a simple makefile to build the final .pyd. |
| 218 | |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 219 | 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 Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 230 | |
| 231 | YOUR OWN EXTENSION DLLs |
| 232 | ----------------------- |
| 233 | If you want to create your own extension module DLL, there's an example |
| 234 | with easy-to-follow instructions in ../PC/example/; read the file |
| 235 | readme.txt there first. |