PyCrypto builds neither with MSVC nor MinGW
casevh at gmail.com
casevh at gmail.com
Mon Mar 12 23:59:38 EDT 2012
On Monday, March 12, 2012 1:38:29 PM UTC-7, Alec Taylor wrote:
> On a brand new Windows install now, with a brand new VS8 installed
> with new YASM and MPIR in c:\usr\src\include and c:\usr\src\lib.
>
> But it still isn't working:
>
This was a little challenging. I looked through the setup.py to figure out what assumptions their build process made. First, the file pycrypto-2.5\src\inc-msvc\config.h must be modified. Below is the file I used:
config.h
===================================================================
/* Define to 1 if you have the declaration of `mpz_powm', and to 0 if you
don't. */
#define HAVE_DECL_MPZ_POWM 1
/* Define to 1 if you have the declaration of `mpz_powm_sec', and to 0 if you
don't. */
#define HAVE_DECL_MPZ_POWM_SEC 0
/* Define to 1 if you have the `gmp' library (-lgmp). */
#undef HAVE_LIBGMP
/* Define to 1 if you have the `mpir' library (-lmpir). */
#define HAVE_LIBMPIR 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
===================================================================
Although I was able to specify an include directory for mpir.h with -Ic:\usr\include, I was not able specify a lib directory with -Lc:\usr\lib. It looks like setup.py does not honor the -L option. So I finally gave up and just copied the mpir.h file into my Python27\include directory and the mpir.lib file into my Python27\libs directory.
After copying the files "python setup.py install" was successful. I created a binary installer with "python setup.py bdist-wininst".
There may be a cleaner way to build PyCrypto, but these steps worked for me.
casevh
More information about the Python-list
mailing list