Update instructions to build pypy from Windows...
If you check documentation from: https://doc.pypy.org/en/latest/build.html
there are not instructions for building pypy from Windows.
Using choco I was able to install pypy version 2, https://community.chocolatey.org/packages/python.pypy
and using miniconda: (https://community.chocolatey.org/packages/miniconda3)
choco install miniconda3
and 'Anaconda prompt' - it's possible to get pypy build
using command line like this:
(base) C:\Users\...>conda create -c conda-forge -n pypy pypy
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.9.2
latest version: 4.10.3
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: C:\tools\miniconda3\envs\pypy
added / updated specs:
- pypy
The following packages will be downloaded:
package | build
---------------------------|-----------------
bzip2-1.0.8 | h8ffe710_4 149 KB conda-forge
ca-certificates-2021.5.30 | h5b45459_0 171 KB conda-forge
expat-2.4.1 | h39d44d4_0 279 KB conda-forge
libffi-3.4.2 | h0e60522_1 41 KB conda-forge
openssl-1.1.1l | h8ffe710_0 5.7 MB conda-forge
pip-21.2.4 | pyhd8ed1ab_0 1.1 MB conda-forge
pypy-7.3.5 | 1_pypy37 4 KB conda-forge
pypy3.7-7.3.5 | h965bf05_9 27.8 MB conda-forge
python-3.7.10 | 1_73_pypy 5 KB conda-forge
python_abi-3.7 | 2_pypy37_pp73 4 KB conda-forge
setuptools-58.0.3 | py37h4c0cbd9_0 950 KB conda-forge
sqlite-3.36.0 | h8ffe710_0 1.2 MB conda-forge
tk-8.6.11 | h8ffe710_1 3.8 MB conda-forge
ucrt-10.0.20348.0 | h57928b3_0 1.2 MB conda-forge
vc-14.2 | hb210afc_5 13 KB conda-forge
vs2015_runtime-14.29.30037 | h902a5da_5 1.3 MB conda-forge
wheel-0.37.0 | pyhd8ed1ab_1 31 KB conda-forge
xz-5.2.5 | h62dcd97_1 211 KB conda-forge
zlib-1.2.11 | h62dcd97_1010 126 KB conda-forge
------------------------------------------------------------
Total: 44.1 MB
The following NEW packages will be INSTALLED:
bzip2 conda-forge/win-64::bzip2-1.0.8-h8ffe710_4
ca-certificates conda-forge/win-64::ca-certificates-2021.5.30-h5b45459_0
expat conda-forge/win-64::expat-2.4.1-h39d44d4_0
libffi conda-forge/win-64::libffi-3.4.2-h0e60522_1
openssl conda-forge/win-64::openssl-1.1.1l-h8ffe710_0
pip conda-forge/noarch::pip-21.2.4-pyhd8ed1ab_0
pypy conda-forge/noarch::pypy-7.3.5-1_pypy37
pypy3.7 conda-forge/win-64::pypy3.7-7.3.5-h965bf05_9
python conda-forge/win-64::python-3.7.10-1_73_pypy
python_abi conda-forge/win-64::python_abi-3.7-2_pypy37_pp73
setuptools conda-forge/win-64::setuptools-58.0.3-py37h4c0cbd9_0
sqlite conda-forge/win-64::sqlite-3.36.0-h8ffe710_0
tk conda-forge/win-64::tk-8.6.11-h8ffe710_1
ucrt conda-forge/win-64::ucrt-10.0.20348.0-h57928b3_0
vc conda-forge/win-64::vc-14.2-hb210afc_5
vs2015_runtime conda-forge/win-64::vs2015_runtime-14.29.30037-h902a5da_5
wheel conda-forge/noarch::wheel-0.37.0-pyhd8ed1ab_1
xz conda-forge/win-64::xz-5.2.5-h62dcd97_1
zlib conda-forge/win-64::zlib-1.2.11-h62dcd97_1010
Proceed ([y]/n)? y
Downloading and Extracting Packages
zlib-1.2.11 | 126 KB | ############################################################################ | 100%
wheel-0.37.0 | 31 KB | ############################################################################ | 100%
python_abi-3.7 | 4 KB | ############################################################################ | 100%
tk-8.6.11 | 3.8 MB | ############################################################################ | 100%
pip-21.2.4 | 1.1 MB | ############################################################################ | 100%
vc-14.2 | 13 KB | ############################################################################ | 100%
expat-2.4.1 | 279 KB | ############################################################################ | 100%
xz-5.2.5 | 211 KB | ############################################################################ | 100%
vs2015_runtime-14.29 | 1.3 MB | ############################################################################ | 100%
ucrt-10.0.20348.0 | 1.2 MB | ############################################################################ | 100%
setuptools-58.0.3 | 950 KB | ############################################################################ | 100%
pypy3.7-7.3.5 | 27.8 MB | ############################################################################ | 100%
python-3.7.10 | 5 KB | ############################################################################ | 100%
sqlite-3.36.0 | 1.2 MB | ############################################################################ | 100%
ca-certificates-2021 | 171 KB | ############################################################################ | 100%
bzip2-1.0.8 | 149 KB | ############################################################################ | 100%
pypy-7.3.5 | 4 KB | ############################################################################ | 100%
openssl-1.1.1l | 5.7 MB | ############################################################################ | 100%
libffi-3.4.2 | 41 KB | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate pypy
#
# To deactivate an active environment, use
#
# $ conda deactivate
(Original instructions from here: https://stackoverflow.com/a/62186941/2338477, linux instructions for example: https://conda-forge.org/blog/posts/2020-03-10-pypy/ )
it's possible to download pypy required headers and dlls (expat and so on), but they are not used by pypy build procedure.
Build error manifesting if you try to use pypy build without c++ libraries looks like this:
C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\goal>pypy ../../rpython/bin/rpython --opt=jit
[platform:msg] Updated environment with vsver 160, using x64 True
[translation:info] 2.7.18 (63df5ef41012, Apr 04 2021, 10:20:14)
[PyPy 7.3.4 with MSC v.1927 64 bit (AMD64)]
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Set platform with 'host' cc=None, using cc='cl.exe', version='MSVC 160'
[translation:info] Translating target as defined by targetpypystandalone
[platform:msg] Updated environment with vsver 160, using x64 True
[platform:msg] Updated environment with vsver 160, using x64 True
[translation] PyPy config object:
[translation] [objspace]
[std]
intshortcut = True
optimized_list_getitem = True
withspecialisedtuple = True
[usemodules]
_abc = True
_ast = True
_cffi_backend = True
_codecs = True
_collections = True
_continuation = True
_csv = True
_jitlog = True
_lsprof = True
_md5 = True
_multibytecodec = True
_multiprocessing = True
_pickle_support = True
_pypyjson = True
_random = True
_rawffi = True
_socket = True
_sre = True
_string = True
_testing = True
_weakref = True
array = True
atexit = True
binascii = True
bz2 = True
cmath = True
cpyext = True
errno = True
gc = True
imp = True
marshal = True
math = True
mmap = True
parser = True
pyexpat = True
pypyjit = True
select = True
signal = True
struct = True
symbol = True
thread = True
time = True
token = True
unicodedata = True
zlib = True
[translation:info] Error:
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\rpython\translator\goal\translate.py", line 286, in main
default_goal='compile')
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\rpython\translator\driver.py", line 575, in from_targetspec
spec = target(driver, args)
File "targetpypystandalone.py", line 372, in target
return self.get_entry_point(config)
File "targetpypystandalone.py", line 414, in get_entry_point
self.space = make_objspace(config)
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\tool\option.py", line 33, in make_objspace
return StdObjSpace(config)
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\interpreter\baseobjspace.py", line 440, in __init__
self.initialize()
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\objspace\std\objspace.py", line 114, in initialize
self.make_builtins()
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\interpreter\baseobjspace.py", line 639, in make_builtins
self.install_mixedmodule(mixedname)
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\interpreter\baseobjspace.py", line 676, in install_mixedmodule
self.setbuiltinmodule(mixedname)
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\interpreter\baseobjspace.py", line 517, in setbuiltinmodule
mod = Module(self, self.newtext(name))
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\module\pyexpat\moduledef.py", line 70, in __init__
from pypy.module.pyexpat import interp_pyexpat
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\pypy\module\pyexpat\interp_pyexpat.py", line 33, in <module>
include_dir='lib', library_dir='win32/bin/release'),
File "C:\PrototypingQuick\Python_8_2021\pypy-branch-py3.8\rpython\rtyper\tool\rffi_platform.py", line 844, in configure_external_library
raise last_error
[translation:ERROR] CompilationError: CompilationError(err="""
platcheck_72.c
c:\users\...\appdata\local\temp\usession-py3.8-2\platcheck_72.c(92): fatal error C1083: Cannot open include file: 'expat.h': No such file or directory
""")
[translation] start debugger...
> c:\prototypingquick\python_8_2021\pypy-branch-py3.8\rpython\rtyper\tool\rffi_platform.py(844)configure_external_library()
-> raise last_error
(Pdb+)
It would be nice if conda could be used to bring required C++ libraries and pypy script would in a turn just use them out of box, using same folder structure as conda + pypy downloaded (but it's not mandatory).