0

我的机器上似乎没有安装 Scrypt。我在这里安装了适用于 Windows 的版本。我使用Visual Studio免费版,安装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.0\VC\BIN\amd64\cl.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-Win32\include -IC:\Python27\include -IC:\Python27\PC /Tcsrc/scrypt2.c /Fobuild\temp.win-amd64-2.7\Release\src/scrypt2.obj
scrypt2.c
scrypt-1.1.6/lib\scryptenc/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.0\VC\BIN\amd64\cl.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.0\VC\BIN\amd64\cl.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-Win32\include -IC:\Python27\include -IC:\Python27\PC /Tcsrc/scrypt2.c /Fobuild\temp.win-amd64-2.7\Release\src/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.0\VC\BIN\amd64\cl.exe"' failed with exit status 2

Update2:不想使用 GCC 编译:

>setup.py build -c mingw32
running build
running build_ext
building 'scrypt' extension
C:\MinGW64\bin\gcc.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-Win32\include -IC:\Python27\include -IC:\Python27\PC -c  src/scrypt2.c -o build\temp.win-amd64-2.7\Release\src\scrypt2.o
gcc: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1

-mno-cygwin并且没有gcc --help

编辑 n:

>setup.py build -c mingw32
running build
running build_ext
building 'scrypt' extension
C:\MinGW64\bin\gcc.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-Win32\include -IC:\Python27\include -IC:\Python27\PC -c src/scrypt2.c -o  build\temp.win-amd64-2.7\Release\src\scrypt2.o
C:\MinGW64\bin\gcc.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-Win32\include -IC:\Python27\include -IC:\Python27\PC -c scrypt- 1.1.6/lib/crypto/crypto_aesctr.c -o build\temp.win-amd64-2.7\Release\scrypt- 1.1.6\lib\crypto\crypto_aesctr.o
In file included from scrypt-1.1.6/lib/crypto/crypto_aesctr.c:34:0:
c:\OpenSSL-Win32\include/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-Win32\include/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
4

1 回答 1

1

stdint.h是 C99 的一部分。Microsoft 的 C 编译器不支持 C99。您可能必须使用像MinGW这样的其他编译器或使用类似msinttypes的东西。

于 2012-12-30T22:31:33.477 回答