似乎Scrypt没有在我的计算机上安装。我在此处安装了Windows版本。我使用了Visual Studio Free Edition,安装了OpenSSL 32位,并成功地编译了BCRypt;但是Scrypt返回此错误:
> setup.py install
running install
running build
running build_ext
building 'scrypt' extension
C:Program Files (x86)Microsoft Visual Studio 9.0VCBINamd64cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -IC:Python27include -IC:Python27PC /Tcsrc/scrypt2.c /Fobuildtemp.win-amd64-2.7Releasesrc/scrypt2.obj
scrypt2.c
scrypt-1.1.6/libscryptenc/scryptenc.h(32) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
error: command '"C:Program Files (x86)Microsoft Visual Studio 9.0VCBINamd64cl.exe"' failed with exit status 2
Exit code: 1
更新:复制库,现在我遇到了另一个错误:
running install
running build
running build_ext
building 'scrypt' extension
C:Program Files (x86)Microsoft Visual Studio 9.0VCBINamd64cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -IC:Python27include -IC:Python27PC /Tcsrc/scrypt2.c /Fobuildtemp.win-amd64-2.7Releasesrc/scrypt2.obj
scrypt2.c
src/scrypt2.c(72) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int',possible loss of data
src/scrypt2.c(73) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
src/scrypt2.c(87) : error C2143: syntax error : missing ';' before 'type'
src/scrypt2.c(92) : error C2065: 'value' : undeclared identifier
src/scrypt2.c(92) : warning C4047: '=' : 'int' differs in levels of indirection from 'PyObject *'
src/scrypt2.c(96) : error C2065: 'value' : undeclared identifier
src/scrypt2.c(96) : warning C4047: 'return' : 'PyObject *' differs in levels of indirection from 'int'
src/scrypt2.c(99) : error C2143: syntax error : missing '{' before '*'
src/scrypt2.c(132) : error C2143: syntax error : missing ';' before 'type'
src/scrypt2.c(136) : error C2065: 'value' : undeclared identifier
src/scrypt2.c(136) : warning C4047: '=' : 'int' differs in levels of indirection from 'PyObject *'
src/scrypt2.c(139) : error C2065: 'value' : undeclared identifier
src/scrypt2.c(139) : warning C4047: 'return' : 'int *' differs in levels of indirection from 'int'
src/scrypt2.c(142) : error C2061: syntax error : identifier 'ScryptMethods'
src/scrypt2.c(142) : error C2059: syntax error : ';'
src/scrypt2.c(142) : error C3409: empty attribute block is not allowed
src/scrypt2.c(142) : error C2513: '/*global*/ ' : no variable declared before '='
src/scrypt2.c(151) : error C2065: 'ScryptMethods' : undeclared identifier
src/scrypt2.c(151) : warning C4047: 'function' : 'PyMethodDef *' differs in levels of indirection from 'int'
src/scrypt2.c(151) : warning C4024: 'Py_InitModule4_64' : different types for formal and actual parameter 2
error: command '"C:Program Files (x86)Microsoft Visual Studio 9.0VCBINamd64cl.exe"' failed with exit status 2
Update2:不想使用GCC进行编译:
>setup.py build -c mingw32
running build
running build_ext
building 'scrypt' extension
C:MinGW64bingcc.exe -mno-cygwin -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 - Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -IC:Python27include -IC:Python27PC -c src/scrypt2.c -o buildtemp.win-amd64-2.7Releasesrcscrypt2.o
gcc: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
,gcc --help
-mno-cygwin
编辑n:
>setup.py build -c mingw32
running build
running build_ext
building 'scrypt' extension
C:MinGW64bingcc.exe -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -IC:Python27include -IC:Python27PC -c src/scrypt2.c -o buildtemp.win-amd64-2.7Releasesrcscrypt2.o
C:MinGW64bingcc.exe -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -IC:Python27include -IC:Python27PC -c scrypt- 1.1.6/lib/crypto/crypto_aesctr.c -o buildtemp.win-amd64-2.7Releasescrypt- 1.1.6libcryptocrypto_aesctr.o
In file included from scrypt-1.1.6/lib/crypto/crypto_aesctr.c:34:0:
c:OpenSSL-Win32include/openssl/aes.h:1:1: error: expected identifier or '(' before '.' token
In file included from scrypt-1.1.6/lib/crypto/crypto_aesctr.h:34:0,
from scrypt-1.1.6/lib/crypto/crypto_aesctr.c:38:
c:OpenSSL-Win32include/openssl/aes.h:1:1: error: expected identifier or '(' before '.' token
In file included from scrypt-1.1.6/lib/crypto/crypto_aesctr.c:38:0:
scrypt-1.1.6/lib/crypto/crypto_aesctr.h:51:5: warning: 'struct crypto_aesctr' declared inside parameter list [enabled by default]
scrypt-1.1.6/lib/crypto/crypto_aesctr.h:51:5: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
scrypt-1.1.6/lib/crypto/crypto_aesctr.h:57:32: warning: 'struct crypto_aesctr' declared inside parameter list [enabled by default]
scrypt-1.1.6/lib/crypto/crypto_aesctr.c:41:2: error: unknown type name 'AES_KEY'
scrypt-1.1.6/lib/crypto/crypto_aesctr.c:54:20: error: unknown type name 'AES_KEY'
scrypt-1.1.6/lib/crypto/crypto_aesctr.c:82:1: error: conflicting types for 'crypto_aesctr_stream'
In file included from scrypt-1.1.6/lib/crypto/crypto_aesctr.c:38:0:
scrypt-1.1.6/lib/crypto/crypto_aesctr.h:50:6: note: previous declaration of 'crypto_aesctr_stream' was here
scrypt-1.1.6/lib/crypto/crypto_aesctr.c: In function 'crypto_aesctr_stream':
scrypt-1.1.6/lib/crypto/crypto_aesctr.c:97:4: warning: implicit declaration of function 'AES_encrypt' [-Wimplicit-function-declaration]
scrypt-1.1.6/lib/crypto/crypto_aesctr.c: At top level:
scrypt-1.1.6/lib/crypto/crypto_aesctr.c:113:1: error: conflicting types for 'crypto_aesctr_free'
In file included from scrypt-1.1.6/lib/crypto/crypto_aesctr.c:38:0:
scrypt-1.1.6/lib/crypto/crypto_aesctr.h:57:6: note: previous declaration of 'crypto_aesctr_free' was here
error: command 'gcc' failed with exit status 1
stdint.h
是C99的一部分。微软的C编译器不支持C99。您可能必须使用其他编译器,例如mingw或使用MSINTTYPES。