Can be dealt with as part of #300
session info dialog showing availability of pycrypto's fastmath
This solution works for me: Building PyCrypto with fastmath (gmp or mpir) via pip on Windows (remove existing version before installing - and remember to use "export VAR=value
" syntax in the mingw32 shell!)
You can verify it is installed with:
C:\Python27\Python.exe -c "from Crypto.PublicKey import _fastmath;print(_fastmath);"
And as of r4511, it is also shown on session info as "(fastmath available)
":
Please confirm and close.
Followed the same solution that worked for you. Compiled and Installed with minor issues.
There was an issue with the test units but doesn't seem to affect anything. Will reopen this ticket if I find a problem.
Notes:
Was easier to rebuild with an up to date mingw32 environment and the libgmp it can install.
In a mingw shell:
mingw-get.exe update mingw-get.exe upgrade mingw-get.exe install mingw32-libgmp
Then in the pycrypto source directory, just:
./configure /c/Python27/python.exe setup.py build -c mingw32 /c/Python27/python.exe setup.py test /c/Python27/python.exe setup.py install
Note: this does not seem to work for Python 3.3 and 3.4, where the resulting module causes crashes at runtime
Note: as of version 0.12.x, you can also verify the presence of pycrypto's fastmath with Network_info.exe
:
C:\Program Files\Xpra>Network_info.exe Network interfaces found: * {0F7E7AF4-D168-429C-86D0-0687BA76F4A5} * MS TCP Loopback interface Protocol Capabilities: * bencode : True * bencode.version : Cython, 0.11 * digest : hmac, xor * lz4 : True * mmap : True * pycrypto.fastmath : True * pycrypto.version : 2.6.1 * rencode : True * rencode.version : Cython, 1.0.2 * yaml : False
PS: you may need to patch some of the mingw header files if you encounter off64_t
and off_t
errors, see here: mingw bug 2024: 'off64_t' does not name a type
For Python 3.x:
./configure --disable-static --enable-shared --with-pic --host=pentium-pc-mingw32 make
cd gmp-6.0.0 cd .libs lib /def:libgmp-3.dll.def /out:gmp.lib
gmp.lib
to the pycrypto source dir
gmp.h
to pycrypto's src/inc-msvc
dir
src/inc-msvc/config.h
:
#define HAVE_DECL_MPZ_POWM 1 #define HAVE_DECL_MPZ_POWM_SEC 1 #define HAVE_LIBGMP 1
C:\Python34\Python.exe setup.py install
(and verify that it found gmp)
Note: for some reason, the fastmath pyd needs to find the libgmp-3.dll.dll
(and fails no matter what it seems..)
Nasty workaround:
./configure --disable-shared --enable-static --with-pic --host=pentium-pc-mingw32 make
.libs/libgmp.a
and libgcc.a
to pycrypto's source dir
libraries=
line with:
extra_objects=['libgmp.a', 'libgcc.a']
C:\Python34\Python.exe setup.py install
(and verify that it found gmp)
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/373