Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Python 2.7.x on windows #32

Open
jcdevil opened this issue May 30, 2017 · 3 comments
Open

Support for Python 2.7.x on windows #32

jcdevil opened this issue May 30, 2017 · 3 comments

Comments

@jcdevil
Copy link

jcdevil commented May 30, 2017

At the moment, the installation on Windows platform / Python 2.7.x is failing with this error (tested on appveyor) :

c:\projects\pyjks.tox\py\include\site\python2.7\twofish:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
copying twofish.py -> build\lib.win32-2.7
running build_ext
building '_twofish' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\twofish-0.3
C:\Users\appveyor\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Itwofish-0.3 -Ic:\python27\include -Ic:\projects\pyjks.tox\py\PC /Tctwofish-0.3/twofish.c /Fobuild\temp.win32-2.7\Release\twofish-0.3/twofish.obj
twofish.c
c:\users\appveyor\appdata\local\temp\1\pip-build-in0ieu\twofish\twofish-0.3\twofish.h(13) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
error: command 'C:\Users\appveyor\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2

Any advice to make it work ?
Thx for your help

@kurtbrose
Copy link
Owner

kurtbrose commented May 31, 2017

Thanks for the heads up!

The issue is that visual studios doesn't support C99 standard (no stdint.h), which the twofish python package depends on.

We might be able to switch to a pure-python implementation of the twofish cipher for windows:

http:https://www.bjrn.se/code/twofishpy.txt

Gpgme has a twofish cipher implementation available -- that may be another possibility:

https://gnupg.org/documentation/manuals/gcrypt/Available-ciphers.html#Available-ciphers

However, pure-python seems the more realistic fix. I don't know if anybody has the appetite for new bindings for this old algorithm.

@kurtbrose
Copy link
Owner

kurtbrose commented May 31, 2017

More useful for you, try setting python to use MinGW which does support C99:

http:https://cython.readthedocs.io/en/latest/src/tutorial/appendix.html

Download the MinGW installer from http:https://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite. 
(As of this writing, the download link is a bit difficult to find; it’s under 
“About” in the menu on the left-hand side). You want the file entitled 
“Automated MinGW Installer” (currently version 5.1.4).

Run it and install MinGW. Only the basic package is strictly needed for
 Cython, although you might want to grab at least the C++ compiler as well.

You need to set up Windows’ “PATH” environment variable so that includes
 e.g. “c:\mingw\bin” (if you installed MinGW to “c:\mingw”). The following 
web-page describes the procedure in Windows XP 
(the Vista procedure is similar): http:https://support.microsoft.com/kb/310519

Finally, tell Python to use MinGW as the default compiler (otherwise 
it will try for Visual C). If Python is installed to “c:\Python27”, 
create a file named “c:\Python27\Lib\distutils\distutils.cfg” containing:

[build]
compiler = mingw32

@jcdevil
Copy link
Author

jcdevil commented May 31, 2017

@kurtbrose : Thx for your answer ;)
I indeed agree that the pure-python implementation seems really interesting ^^ ... I'll try to have a look at it.
But ATM, MinGW is indeed a good backup solution - I may install it on my windows VM :)
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants