2

I am trying to install pycrypto on my Windows machine. I have mingw installed and distutils is using it. The error here is what I am getting:

In file included from C:\Python27\include/pyconfig.h:68:0,

from C:\Python27\include/Python.h:8,

from src/winrand.c:33:

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:301:1: error: unknown type name 'off64_t'

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:301:36: error: unknown type name 'off64_t'

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:302:1: error: unknown type name 'off64_t'

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:302:39: error: unknown type name 'off64_t'

src/winrand.c:38:0: warning: "_WIN32_WINNT" redefined [enabled by default]

In file included from c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/_mingw.h:35:0,

from c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:27,

from C:\Python27\include/pyconfig.h:68,

from C:\Python27\include/Python.h:8,

from src/winrand.c:33:

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/sdkddkver.h:154:0: note: this is the location of the previous definition

error: command 'gcc' failed with exit status 1

Edit: I found this, but I am not sure how to fix pip install with it. http://ac-archive.sourceforge.net/largefile/largefiles_win32.print.html

Greg
  • 7,233
  • 12
  • 42
  • 53
  • Could it be a 32 vs 64 bit problem, as in you're mixing the two somewhere somehow? – martineau Sep 01 '13 at 03:48
  • That's what I thought at first, so I wiped my whole computer and started over and only picked 32-bit items. – Greg Sep 01 '13 at 03:52
  • 1
    could be relevant: https://github.com/pagespeed/ngx_pagespeed/issues/166 – Mike Vella Sep 01 '13 at 03:54
  • 1
    Any reason why you're not using http://www.voidspace.org.uk/python/modules.shtml#pycrypto ? – korylprince Sep 01 '13 at 03:59
  • I am installing using virtualenv. Even if I used pre-compiled packages, it wouldn't explain this error. Could happen with another package as well. – Greg Sep 01 '13 at 04:06
  • I've seen this a few times. There are other similar questions on stack overflow if you do some digging. Otherwise consider installing gcc. Heres a [relevant link for that](http://stackoverflow.com/questions/6394755/how-to-install-gcc-on-windows-7-machine) – Greg Sep 01 '13 at 04:14
  • Not all extensions can be built with the mingw32 gcc compiler, because the standard for Python was MSVC++ 2008. Unfortunately, the free Express edition has been retired and is no longer available. See comments for the question [_How do I point easy_install to vcvarsall.bat?_](http://stackoverflow.com/q/6551724/355230). – martineau Nov 22 '13 at 00:44

2 Answers2

2

I met the same problem when building Fabric in windows. The reason was mingw32's gcc config when building pycrypto. In configure, gcc's setting -std is set to c99. But, when -std is c99, __STRICT_ANSI__ is defined and typedef _off_t off_t and _off64_t off64_t in "sys/types.h" are skipped. I succeeded to build pycrypto by modifying sys/types.h in mingw32 but it was brutal.

huckebein
  • 21
  • 3
0
  1. Create a virtualenv (I usually put all mine on the desktop)

  2. Download the binary of pycrypto (matching your installed python version and architecture - no support for python3 as of now) - http://www.voidspace.org.uk/python/modules.shtml

  3. navigate to the easy_install executable (under Lib\site-packages) within the virtualenv folder you created and run the pycrypto install: easy_install C:\path\to\the\download\pycrypto-2.6.win-amd64-py2.7.exe

techraf
  • 64,883
  • 27
  • 193
  • 198
snassr
  • 1,228
  • 14
  • 10