3

我尝试在我的 Mac OSX Lion 上为 PyPy 安装 Pygame 版本 1.9.1release。我先跑pypy config.pypypy setup.py install。我将配置添加到安装过程中,因为我看到它正在尝试使用普通 python 进行配置(正确安装,但会导致导入错误)。在安装过程中,有很多警告,例如:

src/overlay.c:44:5: warning: implicit declaration of function 'PyObject_Free' is invalid in C99 [-Wimplicit-function-declaration]
PyObject_Free ((PyObject*)self);
^

但它也为我提供了 2 个类似的错误:

    In file included from src/scale_mmx.c:33:
src/scale_mmx64.c:424:27: error: invalid instruction mnemonic 'movsxl'
        asm __volatile__( " /* MMX code for inner loop of X bilinear filter */ "
                          ^
<inline asm>:1:191: note: instantiated into assembly here
         /* MMX code for inner loop of X bilinear filter */  movl             -36(%rbp),      %ecx;            pxor          %mm0,      %mm0;           1:                                           movsxl         (%rdi), ...
                                                                                                                                                                                                     ^~~~~~
In file included from src/scale_mmx.c:33:
src/scale_mmx64.c:499:27: error: invalid instruction mnemonic 'movsxl'
        asm __volatile__( " /* MMX code for inner loop of X bilinear filter */ "
                          ^
<inline asm>:1:191: note: instantiated into assembly here
         /* MMX code for inner loop of X bilinear filter */  movl             -36(%rbp),      %ecx;            pxor          %mm0,      %mm0;           1:                                           movsxl         (%rdi), ...
                                                                                                                                                                                                     ^~~~~~
2 errors generated.

对我来说,PyPy 卡在生成似乎是 C 中的块注释的行对我来说似乎很愚蠢。为什么它将注释封装在 asm 和 volatile 中是我无法理解的。但这是提供给我并在常规 python 中工作的代码。那么这是一个错误吗?还是我错过了什么?

4

1 回答 1

2

Chances are PyPy has some #defines different than CPython (for good or bad reasons) and pygame chooses to use something else (based on a badly thought out #else with implicit assumptions) that tries to compile invalid C. I'm just guessing though, you would need to follow why and how the same code is/is not compiled on CPython.

于 2012-05-21T18:34:39.787 回答