所以,我开发了一个python性能测试来在HSM上运行一些测试。我按照指示下载PyKCS11,这是我在远程机器上需要的一个重要模块。我安装了最新版本的swig,我试图在我在机器上的目录中下载的PyKCS11文件夹上运行make build。运行make build时,我收到了大量的错误。关于这些错误发生了什么的建议?
make build
python setup.py build
running build
running build_py
running build_ext
building 'PyKCS11._LowLevel' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/ck_attribute_smart.cpp -o build/temp.linux-x86_64-2.6/src/ck_attribute_smart .o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/pkcs11lib.cpp -o build/temp.linux-x86_64-2.6/src/pkcs11lib.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/pykcs11string.cpp -o build/temp.linux-x86_64-2.6/src/pykcs11string.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/utility.cpp -o build/temp.linux-x86_64-2.6/src/utility.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/pykcs11_wrap.cpp -o build/temp.linux-x86_64-2.6/src/pykcs11_wrap.o
src/pykcs11_wrap.cpp:173:21: error: Python.h: No such file or directory
src/pykcs11_wrap.cpp:3050:4: error: #error "This python version requires swig to be run with the '-classic' option"
src/pykcs11_wrap.cpp:803: error: ‘PyObject’ was not declared in this scope
src/pykcs11_wrap.cpp:803: error: ‘str’ was not declared in this scope
src/pykcs11_wrap.cpp:804: error: expected ‘,’ or ‘;’ before ‘{’ token
src/pykcs11_wrap.cpp:827: error: expected initializer before ‘*’ token
src/pykcs11_wrap.cpp:853: error: expected initializer before ‘*’ token
src/pykcs11_wrap.cpp:903: error: expected initializer before ‘*’ token
src/pykcs11_wrap.cpp:918: error: ‘inquiry’ does not name a type
src/pykcs11_wrap.cpp:919: error: ‘intargfunc’ does not name a type
src/pykcs11_wrap.cpp:920: error: ‘intintargfunc’ does not name a type
src/pykcs11_wrap.cpp:921: error: ‘intobjargproc’ does not name a type
src/pykcs11_wrap.cpp:922: error: ‘intintobjargproc’ does not name a type
src/pykcs11_wrap.cpp:923: error: ‘getreadbufferproc’ does not name a type
src/pykcs11_wrap.cpp:924: error: ‘getwritebufferproc’ does not name a type
src/pykcs11_wrap.cpp:925: error: ‘getsegcountproc’ does not name a type
src/pykcs11_wrap.cpp:926: error: ‘getcharbufferproc’ does not name a type
src/pykcs11_wrap.cpp:927: error: ‘PyObject’ was not declared in this scope
src/pykcs11_wrap.cpp:927: error: ‘x’ was not declared in this scope
src/pykcs11_wrap.cpp:927: error: expected primary-expression before ‘void’
src/pykcs11_wrap.cpp:927: error: initializer expression list treated as compound expression
src/pykcs11_wrap.cpp:928: error: expected ‘,’ or ‘;’ before ‘{’ token
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include /c++/4.4.7/stdexcept:38,
from src/pykcs11_wrap.cpp:3074:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:3 5: error: expected declaration before end of line
error: command 'gcc' failed with exit status 1
make: *** [build-stamp] Error 1

抱歉这个疯狂的堆栈跟踪。我不确定如何压缩它,因此它显示了可能的解决方案的正确错误消息。无论如何,这是我在远程机器上运行python脚本时得到的结果。 我相信找到正确的编译器会遇到问题,但我并不完全确定。
此外,我在调用解释器时尝试导入PyKCS11以查看更简化的错误版本。
>>> import PyKCS11
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "PyKCS11/__init__.py", line 20, in <module>
import PyKCS11.LowLevel
File "PyKCS11/LowLevel.py", line 39, in <module>
LowLevel = swig_import_helper()
File "PyKCS11/LowLevel.py", line 31, in swig_import_helper
import _LowLevel
ImportError: No module named _LowLevel