# pypy / pypy / doc / windows.rst

 David Malcolm 47ed8f9 2011-03-16 David Malcolm 1e46012 2011-03-14 mattip 7f02f3e 2012-12-05 David Malcolm 1e46012 2011-03-14 kris...@kristjan… 428cdec 2011-04-29 mattip 861ddd5 2012-03-21 kris...@kristjan… 428cdec 2011-04-29 mattip d270e84 2012-04-24 kris...@kristjan… 428cdec 2011-04-29 mattip 861ddd5 2012-03-21 kris...@kristjan… 428cdec 2011-04-29 David Malcolm 1e46012 2011-03-14 Maciej Fijalkows… 3512ed4 2011-07-22 Amaury Forgeot d… 3540a8f 2011-07-22 Maciej Fijalkows… 3512ed4 2011-07-22 Amaury Forgeot d… 3540a8f 2011-07-22 Maciej Fijalkows… 3512ed4 2011-07-22 David Malcolm 1e46012 2011-03-14 mattip 9446c0b 2013-01-05 David Malcolm 1e46012 2011-03-14 mattip 9446c0b 2013-01-05 David Malcolm 1e46012 2011-03-14 mattip d270e84 2012-04-24 David Malcolm 1e46012 2011-03-14 mattip d270e84 2012-04-24 David Malcolm 1e46012 2011-03-14 mattip 861ddd5 2012-03-21 David Malcolm 1e46012 2011-03-14 mattip 54f773d 2012-08-19 mattip 9d969f5 2012-03-21 David Malcolm 1e46012 2011-03-14 mattip 9d969f5 2012-03-21 mattip 861ddd5 2012-03-21 mattip 57206e9 2012-03-21 mattip 9d969f5 2012-03-21 David Malcolm 1e46012 2011-03-14 mattip 57206e9 2012-03-21 mattip 861ddd5 2012-03-21 David Malcolm 1e46012 2011-03-14 mattip 861ddd5 2012-03-21 mattip 57206e9 2012-03-21 mattip 861ddd5 2012-03-21 mattip 57206e9 2012-03-21 mattip 861ddd5 2012-03-21 mattip 9d969f5 2012-03-21 mattip 861ddd5 2012-03-21 mattip 54f773d 2012-08-19 mattip 861ddd5 2012-03-21 David Malcolm 1e46012 2011-03-14 lac 1250ec0 2011-04-29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 =============== PyPy on Windows =============== Pypy is supported on Windows platforms, starting with Windows 2000. The following text gives some hints about how to translate the PyPy interpreter. To build pypy-c you need a C compiler. Microsoft Visual Studio is preferred, but can also use the mingw32 port of gcc. Translating PyPy with Visual Studio ----------------------------------- We routinely test the RPython translation toolchain_ using Visual Studio 2008, Express Edition. Other configurations may work as well. The translation scripts will set up the appropriate environment variables for the compiler, so you do not need to run vcvars before translation. They will attempt to locate the same compiler version that was used to build the Python interpreter doing the translation. Failing that, they will pick the most recent Visual Studio compiler they can find. In addition, the target architecture (32 bits, 64 bits) is automatically selected. A 32 bit build can only be built using a 32 bit Python and vice versa. By default pypy is built using the Multi-threaded DLL (/MD) runtime environment. **Note:** PyPy is currently not supported for 64 bit Windows, and translation will fail in this case. The compiler is all you need to build pypy-c, but it will miss some modules that relies on third-party libraries. See below how to get and build them. Preping Windows for the Large Build ----------------------------------- Normally 32bit programs are limited to 2GB of memory on Windows. It is possible to raise this limit, to 3GB on Windows 32bit, and almost 4GB on Windows 64bit. On Windows 32bit, it is necessary to modify the system: follow http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=9583842&linkID=9240617 to enable the "3GB" feature, and reboot. This step is not necessary on Windows 64bit. Then you need to execute:: editbin /largeaddressaware pypy.exe on the pypy.exe file you compiled. Installing external packages ---------------------------- On Windows, there is no standard place where to download, build and install third-party libraries. We recommend installing them in the parent directory of the pypy checkout. For example, if you installed pypy in d:\pypy\trunk\ (This directory contains a README file), the base directory is d:\pypy. You must then set the INCLUDE, LIB and PATH (for DLLs) environment variables appropriately. Abridged method (for -Ojit builds using Visual Studio 2008) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Download the versions of all the external packages from https://bitbucket.org/pypy/pypy/downloads/local.zip Then expand it into the base directory (base_dir) and modify your environment to reflect this:: set PATH=\bin;%PATH% set INCLUDE=\include;%INCLUDE% set LIB=\lib;%LIB% Now you should be good to go. Read on for more information. The Boehm garbage collector ~~~~~~~~~~~~~~~~~~~~~~~~~~~ This library is needed if you plan to use the --gc=boehm translation option (this is the default at some optimization levels like -O1, but unneeded for high-performance translations like -O2). You may get it at http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.1.tar.gz Versions 7.0 and 7.1 are known to work; the 6.x series won't work with pypy. Unpack this folder in the base directory. Then open a command prompt:: cd gc-7.1 nmake -f NT_THREADS_MAKEFILE copy Release\gc.dll The zlib compression library ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Download http://www.gzip.org/zlib/zlib-1.2.3.tar.gz and extract it in the base directory. Then compile:: cd zlib-1.2.3 nmake -f win32\Makefile.msc copy zlib1.dll \zlib.dll The bz2 compression library ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Download http://bzip.org/1.0.5/bzip2-1.0.5.tar.gz and extract it in the base directory. Then compile:: cd bzip2-1.0.5 nmake -f makefile.msc The expat XML parser ~~~~~~~~~~~~~~~~~~~~ Download the source code of expat on sourceforge: http://sourceforge.net/projects/expat/ and extract it in the base directory. Version 2.1.0 is known to pass tests. Then open the project file expat.dsw with Visual Studio; follow the instruction for converting the project files, switch to the "Release" configuration, reconfigure the runtime for Multi-threaded DLL (/MD) and build the solution (the expat project is actually enough for pypy). Then, copy the file win32\bin\release\libexpat.dll somewhere in your PATH. The OpenSSL library ~~~~~~~~~~~~~~~~~~~ OpenSSL needs a Perl interpreter to configure its makefile. You may use the one distributed by ActiveState, or the one from cygwin. In both case the perl interpreter must be found on the PATH. Get http://www.openssl.org/source/openssl-0.9.8k.tar.gz and extract it in the base directory. Then compile:: perl Configure VC-WIN32 ms\do_ms.bat nmake -f ms\nt.mak install Using the mingw compiler ------------------------ You can compile pypy with the mingw compiler, using the --cc=mingw32 option; gcc.exe must be on the PATH. If the -cc flag does not begin with "ming", it should be the name of a valid gcc-derivative compiler, i.e. x86_64-w64-mingw32-gcc for the 64 bit compiler creating a 64 bit target. You probably want to set the CPATH, LIBRARY_PATH, and PATH environment variable to the header files, lib or dlls, and dlls respectively of the locally installed packages if they are not in the mingw directory heirarchy. libffi for the mingw compiler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To enable the _rawffi (and ctypes) module, you need to compile a mingw version of libffi. Here is one way to do this, wich should allow you to try to build for win64 or win32: #. Download and unzip a mingw32 build_ or mingw64 build_, say into c:\mingw #. If you do not use cygwin, you will need msys to provide make, autoconf tools and other goodies. #. Download and unzip a msys for mingw_, say into c:\msys #. Edit the c:\msys\etc\fstab file to mount c:\mingw #. Download and unzip the libffi source files_, and extract them in the base directory. #. Run c:\msys\msys.bat or a cygwin shell which should make you feel better since it is a shell prompt with shell tools. #. From inside the shell, cd to the libffi directory and do:: sh ./configure make cp .libs/libffi-5.dll If you can't find the dll, and the libtool issued a warning about "undefined symbols not allowed", you will need to edit the libffi Makefile in the toplevel directory. Add the flag -no-undefined to the definition of libffi_la_LDFLAGS If you wish to experiment with win64, you must run configure with flags:: sh ./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 or such, depending on your mingw64 download. hacking on Pypy with the mingw compiler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Since hacking on Pypy means running tests, you will need a way to specify the mingw compiler when hacking (as opposed to translating). As of March 2012, --cc is not a valid option for pytest.py. However if you set an environment variable CC to the compliter exe, testing will use it. .. _'mingw32 build': http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Automated%20Builds .. _mingw64 build: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds .. _msys for mingw: http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/MSYS%20%2832-bit%29 .. _libffi source files: http://sourceware.org/libffi/ .. _RPython translation toolchain: translation.html
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.