【问题标题】:Building Pillow for PyPy - unresolved externals为 PyPy 构建枕头 - 未解决的外部问题
【发布时间】:2014-01-03 08:08:15
【问题描述】:

我一直在努力使用 easy_install 在我的 Windows (XP) 安装上构建 Pillow for PyPy (2.1)。 问题似乎与它缺少所需的 python/pypy 标头(?)有关。我已经在谷歌上下搜索了好几天,希望能找到一些可以详细说明我遇到的问题的人,但没有找到任何有用的东西。

我得到的错误日志是:

...

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -IlibImaging -IC:\pypy-21\include -IC:\pypy-21\include /Tc
libImaging\UnsharpMask.c /Fobuild\temp.win32-2.7\Release\libImaging\UnsharpMask.obj

...
decode.obj : error LNK2001: unresolved external symbol __imp__PyType_Type
encode.obj : error LNK2001: unresolved external symbol __imp__PyType_Type
map.obj : error LNK2001: unresolved external symbol __imp__PyType_Type
encode.obj : error LNK2019: unresolved external symbol __imp___PyString_Resize r
eferenced in function __encode
encode.obj : error LNK2019: unresolved external symbol __imp__PyErr_SetFromErrno
 referenced in function __encode_to_file
encode.obj : error LNK2019: unresolved external symbol __imp__PyExc_SystemError
referenced in function __setimage
display.obj : error LNK2019: unresolved external symbol __imp__PyList_Append ref
erenced in function _list_windows_callback@8
display.obj : error LNK2019: unresolved external symbol __imp__PyErr_Print refer
enced in function _callback_error
display.obj : error LNK2019: unresolved external symbol __imp__PyFile_WriteStrin
g referenced in function _callback_error
display.obj : error LNK2019: unresolved external symbol __imp__PySys_GetObject r
eferenced in function _callback_error
display.obj : error LNK2019: unresolved external symbol _PyObject_CallFunction r
eferenced in function _windowCallback@16
path.obj : error LNK2001: unresolved external symbol _PyObject_CallFunction
display.obj : error LNK2019: unresolved external symbol __imp__PyThreadState_Swa
p referenced in function _windowCallback@16
display.obj : error LNK2019: unresolved external symbol __imp__PyThreadState_Get
 referenced in function _PyImaging_CreateWindowWin32
path.obj : error LNK2019: unresolved external symbol __imp__PyErr_ExceptionMatch
es referenced in function _PyPath_Flatten
path.obj : error LNK2019: unresolved external symbol __imp__PyNumber_Check refer
enced in function _PyPath_Flatten
path.obj : error LNK2019: unresolved external symbol __imp__PyExc_RuntimeError r
eferenced in function _path_clip_polygon
build\lib.win32-2.7\_imaging.pypy-21.pyd : fatal error LNK1120: 61 unresolved ex
ternals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.e
xe' failed with exit status 1120

我真的很难明白为什么会发生这种情况,我实际上不知道。我可以轻松地为 CPython 构建包。

据我所知,还包括依赖项文件夹:“-IC:\pypy-21\include”(?)。

更多日志可以查看http://pastebin.com/raw.php?i=kKnNpRgr

编辑 - 解决方案

在获取 PyPy 2.2.1 之后,我发现我的“PyPy-21/Include”路径中确实缺少一些文件。所以.. Pillow 与新发现的标头一起安装得很好,并且运行完美! =)

【问题讨论】:

    标签: python windows build pypy pillow


    【解决方案1】:

    PyPy 没有实现 CPython 中的整个 C 扩展模块 API。或者更确切地说,PyPy 实现了 Cext 模块最有可能使用的符号的合理子集,但 PyPY 无法在不吸入大部分 CPython 的情况下提供 CPython 提供的每个符号。我希望 CPython 对它向外部代码公开的符号更加小心,但我不相信。

    PyPy 最适合使用纯 Python 模块。它也可以运行(相当缓慢)C 扩展模块的一个子集。你可能会在试图让 PyPy 导入这个特定的 CPython C 扩展模块时打一场失败的战斗。

    请记住,您不能在 PyPy 中 JIT C 代码。

    【讨论】:

    • 我知道 PyPy 的 CPyExt 并不是那么兼容。我正在构建 Pillow,但它与 PyPy 兼容。我可以轻松地在 Linux 发行版上为 PyPy 构建 Pillow。
    猜你喜欢
    • 2015-09-21
    • 1970-01-01
    • 2013-03-19
    • 1970-01-01
    • 2014-05-06
    • 2020-10-15
    • 2011-12-19
    • 2017-09-25
    • 1970-01-01
    相关资源
    最近更新 更多