[Tutor] Can not install pycrypto on Windows 64bit with cygwin(python27)

Muse Gk goknmuse at gmail.com
Sat Sep 22 17:25:11 CEST 2012


eryksun (),

I really appreciate what you had done for me.

I still can not make through those errors. Or I can say there is no
way install pycrypto with MinGW or Cygwin.

>Also, according to http://bugs.python.org/issue4709, you might need
>MS_WIN64 to be manually defined. Try installing like this:

>    python setup.py build_ext -DMS_WIN64 install

>Alternatively, here's a Stack Overflow answer that links to
>step-by-step instructions for using the compiler from the Windows 7
>SDK:

>    http://stackoverflow.com/a/11408432/205580

It seems I have to install Visual Studio 2010, http://mpir.org/ ,
http://gmplib.org/ and maybe more.

I do not know the reason why I really do not want to install Visual
Studio on my machine. Sorry.

Maybe I should create a virtual machine with VirtualBox which OS is
Ubuntu or Fedora.
This will be easy for me.

When I search possible solutions, I do find a much easy way (
http://www.voidspace.org.uk/python/modules.shtml#pycrypto )
Also do not know why I do not just pick it up.

Maybe I thought there were supposed  to have a way to solve all those
errors or bugs, however, by trial and error, I realize I can not make
it.

This is the full logs when build:

C:\Users\gk\Downloads\pycrypto-2.6>python setup.py build --compiler=mingw32
running build
running build_py
running build_ext
running build_configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for __gmpz_init in -lgmp... no
checking for __gmpz_init in -lmpir... no
checking whether mpz_powm is declared... no
checking whether mpz_powm_sec is declared... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for inttypes.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking for inline... inline
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for int8_t... yes
checking for size_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for memmove... yes
checking for memset... yes
configure: creating ./config.status
config.status: creating src/config.h
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

building 'Crypto.Random.OSRNG.winrandom' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\src
C:\Users\gk\Downloads\mingw64\bin\gcc.exe -mno-cygwin -mdll -Wall -std=c99 -O3 -
fomit-frame-pointer -Isrc/ -IC:\Python27\include -IC:\Python27\PC -c src/winrand
.c -o build\temp.win32-2.7\Release\src\winrand.o
src/winrand.c:38:0: warning: "_WIN32_WINNT" redefined
c:\users\gk\downloads\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../.
./x86_64-w64-mingw32/include/_mingw.h:244:0: note: this is the location of the p
revious definition
writing build\temp.win32-2.7\Release\src\winrandom.def
C:\Users\gk\Downloads\mingw64\bin\gcc.exe -mno-cygwin -shared -s build\temp.win3
2-2.7\Release\src\winrand.o build\temp.win32-2.7\Release\src\winrandom.def -LC:\
Python27\libs -LC:\Python27\PCbuild -lws2_32 -ladvapi32 -lpython27 -lmsvcr90 -o
build\lib.win32-2.7\Crypto\Random\OSRNG\winrandom.pyd
c:/users/gk/downloads/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../.
./x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Python27\libs/libpytho
n27.a when searching for -lpython27
c:/users/gk/downloads/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../.
./x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Python27\libs/python27
.lib when searching for -lpython27
c:/users/gk/downloads/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../.
./x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Python27\libs\libpytho
n27.a when searching for -lpython27
c:/users/gk/downloads/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../.
./x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Python27\libs/libpytho
n27.a when searching for -lpython27
c:/users/gk/downloads/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../.
./x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Python27\libs/python27
.lib when searching for -lpython27
c:/users/gk/downloads/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../.
./x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Python27\libs\python27
.lib when searching for -lpython27
c:/users/gk/downloads/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../.
./x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython27
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

I hope you [eryksun()] do not think I am wasting your time.
I really better to give up on installing pycrypto on windows 64bit.

BTW, I am just an application chemistry major student who has much
interests in computer things on spare time.
I better know more about Python and Crypto things and then think about
how to use pycrypto.

Thanks again, eryksun(). NO more take time on my question. You have
done enough for me.

gk


On Sat, Sep 22, 2012 at 8:51 PM, eryksun <eryksun at gmail.com> wrote:
> On Sat, Sep 22, 2012 at 12:25 AM, Muse Gk <goknmuse at gmail.com> wrote:
>>
>> I had tried MinGW-w64 today, however, another more errors happen which
>> just like this (
>> http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o
>> ). Another no solution error.
>>
>> First, I tried to remove all instances of -mno-cygwin in
>> distutils\cygwinccompiler.py and got another different error.
>>
>> Second, keep -mno-cygwin in distutils\cygwinccompiler.py, tried a
>> little version of  MinGW-w64 (
>> http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.5-release/
>> ). This time finally kill the error "gcc: error: unrecognized command
>> line option '-mno-cygwin' ", however, got another one "collect2: ld
>> returned 1 exit status" instead.
>
>
> Which library caused the linker to fail?
>
> Before running setup.py, add the following environment variable with
> the "set" command:
>
>     set LIBRARY_PATH=c:\pythonXX\libs
>
> where XX is your version of Python (e.g. XX is 27 for Python 2.7).
>
> Also, according to http://bugs.python.org/issue4709, you might need
> MS_WIN64 to be manually defined. Try installing like this:
>
>     python setup.py build_ext -DMS_WIN64 install
>
> Alternatively, here's a Stack Overflow answer that links to
> step-by-step instructions for using the compiler from the Windows 7
> SDK:
>
>     http://stackoverflow.com/a/11408432/205580
>
>
>> It seems there is no way I can kill all errors. It took me hours and
>> hours to kill those errors, however, there is still another one. I am
>> feeling very depressed. I do not want to install pycrypto any more. :(
>>
>> I hope there will be an easy way to install it in the short future.
>
> I doubt there will ever be an easy way considering export restrictions
> on cryptography software. Plus you might feel just a bit more secure
> building your own copy.


More information about the Tutor mailing list