#373 closed task (fixed)
gmp and mpfr build for win32 - needed for pycrypto fastmath
Reported by: | Antoine Martin | Owned by: | Smo |
---|---|---|---|
Priority: | minor | Milestone: | 0.11 |
Component: | client | Version: | |
Keywords: | win32 | Cc: |
Description (last modified by )
- http://gmplib.org/
- GMP Install Instruction for Windows Platform (outdated: v4.1)
- mpir: fork for win32
Can be dealt with as part of #300
Attachments (1)
Change History (9)
comment:1 Changed 8 years ago by
Milestone: | 1.0 → 0.11 |
---|---|
Status: | new → assigned |
comment:2 Changed 8 years ago by
Description: | modified (diff) |
---|
Changed 8 years ago by
Attachment: | session-info-showfastmath.png added |
---|
comment:3 Changed 8 years ago by
Owner: | changed from Antoine Martin to Smo |
---|---|
Status: | assigned → new |
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.
comment:4 Changed 7 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.
comment:5 Changed 7 years ago by
Notes:
- pycrypto version 2.6.1 was released on the 2014-06-20 and is an important update (security issues)
- upgrading via easy_install breaks fastmath.. the instruction above have to be used every time (PITA)
- mpir 2.7.0 beta is available (which means that the actual release is likely to happen before too long - and we probably should use it as it fixes RNG security issues, etc)
comment:6 Changed 7 years ago by
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
comment:7 Changed 7 years ago by
For Python 3.x:
- using gmp 6.0.0:
- build it with mingw32 (no way to build with msvc?):
./configure --disable-static --enable-shared --with-pic --host=pentium-pc-mingw32 make
- generate the lib file using a visual studio shell (as per gmplib.org : MS Windows DLLs):
cd gmp-6.0.0 cd .libs lib /def:libgmp-3.dll.def /out:gmp.lib
- build it with mingw32 (no way to build with msvc?):
- copy the
gmp.lib
to the pycrypto source dir - copy the
gmp.h
to pycrypto'ssrc/inc-msvc
dir - edit
src/inc-msvc/config.h
:#define HAVE_DECL_MPZ_POWM 1 #define HAVE_DECL_MPZ_POWM_SEC 1 #define HAVE_LIBGMP 1
- build + install pycrypto:
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:
- make a static version of gmp instead:
./configure --disable-shared --enable-static --with-pic --host=pentium-pc-mingw32 make
- copy
.libs/libgmp.a
andlibgcc.a
to pycrypto's source dir - edit pycrypto's setup.py and replace the fastmath extension's
libraries=
line with:extra_objects=['libgmp.a', 'libgcc.a']
- build + install pycrypto:
C:\Python34\Python.exe setup.py install
(and verify that it found gmp)
- make an xpra build and verify that fastmath is present
- using mpir:
- requires msvc gui... which is stuck on the splash screen on my dev vm..
comment:8 Changed 3 months ago by
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/373
session info dialog showing availability of pycrypto's fastmath