PyCrypto fails to build with pypy/cpyext

Create issue
Issue #997 wontfix
Tristan Seligmann created an issue

From (

Comments (7)

  1. Tristan Seligmann reporter

    PyCrypto is an (optional) Twisted dependency. I'll attach the build log demonstrating the failure.

  2. Amaury Lepicard

    Unfortunately PyCrypto accesses the internal representation of PyLong objects, which pypy cannot expose. This part of PyCrypto (in _fastmath.c: mpzToLongObj and longObjToMPZ) has to be modified before pypy can compile this module.

    Unfortunately the CPython API does not provide many alternatives. _PyLong_FromByteArray() could be used, but it requires an additional copy and would be slower.

    The best would be to invent a new CPython API: PyLong_GET_DIGITS() and PyLong_GET_SIZE(), which PyPy could implement like the string object and allow a mutable buffer until the object exits the function.

  3. Glyph
    Just today I did 'pip install PyCrypto' on PyPy 1.9 and it seemed to work.  Should 
    this be marked as fixed?
  4. Amaury Lepicard
    Glyph, I guess you don't have LIBGMP installed:
    "warning: GMP or MPIR library not found; Not building 
    After installing libgmp-dev, _fastmath.c cannot compile.
  5. Glyph
    The relevant bug against PyCrypto is here:
    Thanks for filing it, fijal.
  6. Log in to comment