[pycrypto] FW: python crypto with python 3.0 or 3.1

Christoph Tapler christoph.tapler at gmx.net
Sun Feb 28 15:04:12 CST 2010


Hi Grail,

Thanks for your patch! I assume you generated the patch based on a Unix
environment. Tried to compile pycrypto together with your patch on my
Windows machine. However, it did not work out.
After fixing two straightforward errors in setup.py (relevant to Windows 
only,
see [1], [2]), I got stuck when linking the module MD4 and other hashing 
methods
(MD2, etc).

Now, when I compare the build process against Python 2, I see the following
difference:

###############################################################################
[Python 2:]
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL 
/nologo /INCRE
MENTAL:NO "/LIBPATH:C:\Program Files\Python26\libs" "/LIBPATH:C:\Program 
Files\P
ython26\PCbuild" /EXPORT:initMD4 
build\temp.win32-2.6\Release\src/MD4.obj /OUT:b
uild\lib.win32-2.6\Crypto\Hash\MD4.pyd 
/IMPLIB:build\temp.win32-2.6\Release\src\
MD4.lib /MANIFESTFILE:build\temp.win32-2.6\Release\src\MD4.pyd.manifest
    Creating library build\temp.win32-2.6\Release\src\MD4.lib and object 
build\te
mp.win32-2.6\Release\src\MD4.exp
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo 
-manifest build
\temp.win32-2.6\Release\src\MD4.pyd.manifest 
-outputresource:build\lib.win32-2.6
\Crypto\Hash\MD4.pyd;2

[Python 3:]
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL 
/nologo /INCRE
MENTAL:NO "/LIBPATH:C:\Program Files\Python31\libs" "/LIBPATH:C:\Program 
Files\P
ython31\PCbuild" /EXPORT:PyInit_MD4 
build\temp.win32-3.1\Release\src/MD4.obj /OU
T:build\lib.win32-3.1\Crypto\Hash\MD4.pyd 
/IMPLIB:build\temp.win32-3.1\Release\s
rc\MD4.lib /MANIFESTFILE:build\temp.win32-3.1\Release\src\MD4.pyd.manifest
LINK : error LNK2001: unresolved external symbol PyInit_MD4
build\temp.win32-3.1\Release\src\MD4.lib : fatal error LNK1120: 1 
unresolved ext
ernals
error: command '"C:\Program Files\Microsoft Visual Studio 
9.0\VC\BIN\link.exe"'
failed with exit status 1120
###############################################################################

It seems that the /EXPORT argument for the Windows Linker is assembled in a
different way. This leads to an export name, which does not exist as 
function.
Hence the linker terminates with an error.

Any idea what I need to change to get the /EXPORT name fixed? Is this 
problem
located in pycrypto or in the Python distutils?


##### Regarding the changes in setup.py:
[1] Changed the following stmt:
From
print << sys.stderr "warning: GMP library not found; Not building 
Crypto.PublicKey._fastmath."
to
print("warning: GMP library not found; Not building 
Crypto.PublicKey._fastmath.", sys.stderr)

[2] (Temporarily) disabled winrand.c which is included when using the 
Windows platform.

Cheers, Christoph



More information about the pycrypto mailing list