在 ubuntu 上设置 pypy 沙箱

Setting up pypy sandbox on ubuntu

这是我在 ubuntu 14 上设置 pypy 沙箱时遇到的错误。 如果您能找到任何线索,请帮忙

(my-pypy-env)sterilistic@sterilistic:~/Desktop/Coderunner/pypy-4.0.1-src/pypy/goal$ ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone.py
[translation:info] 2.7.10 (5f8302b8bf9f, Nov 18 2015, 10:46:49)
[translation:info] [PyPy 4.0.1 with GCC 4.6.3]
[platform:msg] Set platform with 'host' cc=None, using cc='gcc', version='Unknown'
[translation:info] Translating target as defined by targetpypystandalone
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-release-4.0.1-9/gcctest.c -o /tmp/usession-release-4.0.1-9/gcctest.o
[platform:execute] gcc /tmp/usession-release-4.0.1-9/gcctest.o -pthread -Wl,--export-dynamic -lrt -o /tmp/usession-release-4.0.1-9/gcctest
[platform:execute] gcc -c -O3 -pthread -fomit-frame-pointer -Wall -Wno-unused /tmp/usession-release-4.0.1-9/gcctest.c -o /tmp/usession-release-4.0.1-9/gcctest.o
[platform:execute] gcc /tmp/usession-release-4.0.1-9/gcctest.o -pthread -Wl,--export-dynamic -lrt -o /tmp/usession-release-4.0.1-9/gcctest
Traceback (most recent call last):
  File "../../rpython/bin/rpython", line 20, in <module>
    main()
  File "/home/sterilistic/Desktop/Coderunner/pypy-4.0.1-src/rpython/translator/goal/translate.py", line 217, in main
    targetspec_dic, translateconfig, config, args = parse_options_and_load_target()
  File "/home/sterilistic/Desktop/Coderunner/pypy-4.0.1-src/rpython/translator/goal/translate.py", line 156, in parse_options_and_load_target
    targetspec_dic = load_target(targetspec)
  File "/home/sterilistic/Desktop/Coderunner/pypy-4.0.1-src/rpython/translator/goal/translate.py", line 98, in load_target
    mod = __import__(specname)
  File "targetpypystandalone.py", line 13, in <module>
    from rpython.rlib import rthread
  File "/home/sterilistic/Desktop/Coderunner/pypy-4.0.1-src/rpython/rlib/rthread.py", line 1, in <module>
    from rpython.rtyper.lltypesystem import rffi, lltype, llmemory
  File "/home/sterilistic/Desktop/Coderunner/pypy-4.0.1-src/rpython/rtyper/lltypesystem/rffi.py", line 1077, in <module>
    maxint, sizeof(llmemory.Address)))
AssertionError: Mixed configuration of the word size of the machine:
    the underlying Python was compiled with maxint=2147483647,
    but the C compiler says that 'void *' is 8 bytes

C 编译器定义了您的沙箱可以计算多少字节。由于 8 个字节的限制,这似乎是为 32 位机器设计的代码。来自 this 网页:

PyPy/RPython makes a lot of platform/architecture decisions based on the version of python that you use to run the build. Since emscripten provides a 32-bit runtime environment, you'll need to run the build using a 32-bit version of python. (I build in a 32-bit Ubuntu VM to achieve this).

基本上,您需要 运行 Python 的 32 位版本。我不确定如何在 Windows 和 Linux 上执行此操作,但是 here is a Stack Overflow link on how to do it on a mac, which may give you some starting points. Your best bet is to run a VM with a 32-bit version of Ubuntu-- 下载页面上只是 select 32-bit 而不是 64-bit .

祝你好运!

您是 运行 PyPy 4.0.1 32 位,它正在调用 C 编译器,即 gcc 或 clang 64 位。您需要使这两者保持一致,例如通过下载 运行 PyPy 4.0.1 64-bit.