1

因此,我开发了一个 python 性能测试来在 HSM 上运行一些测试。我正在按照说明下载 PyKCS11,这是我在远程机器上需要的一个重要模块。我安装了最新版本的 swig,我正在尝试在我下载到机器目录中的 PyKCS11 文件夹上运行构建。运行 make 构建时,我遇到了非常多的错误。关于这些错误发生了什么的建议?

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
4

0 回答 0