使用boost_python导入错误

2024-10-16 20:51:39 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图加载boost::python构建的模块时,Cygwin上出现了以下错误:

>>> import Whatever
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: Permission denied
我对其他模块(C或C++)没有这样的错误。在

以下是我的最小模块:

^{pr2}$

我是这样做的:

g++ -shared -o Whatever.dll Whatever.cpp -I/usr/include/python2.7 \
       -lboost_python -lpython2.7

所有DLL都有读取和执行权限。在

我只使用cygwin安装的软件,没有二进制或源代码包。GCC版本是6.3.0,Boost是1.60。在

同样的配置也在Linux上运行,不久前它曾经在Cygwin上运行过。在

当我通过strace(在Cygwin上)运行Python时,我得到以下信息:

<tons of output>
--- Process 35608 loaded C:\cygwin64\bin\cygboost_python-1_60.dll at 00000003f7ec0000
--- Process 35608 loaded C:\cygwin64\bin\cyggcc_s-seh-1.dll at 00000005e1570000
--- Process 35608 loaded C:\cygwin64\bin\cygstdc6.dll at 00000005d4da0000
--- Process 35608, exception c0000005 at 00000003f7ee8527
--- Process 35608 thread 48604 exited with status 0xc0000005
--- Process 35608 thread 13756 exited with status 0xc0000005
--- Process 35608 thread 45304 exited with status 0xc0000005
--- Process 35608 exited with status 0xc0000005
Segmentation fault

(这就是strace.exe本身崩溃的原因)

当我用gdb运行它时,我得到了:

Thread 1 "python2.7" received signal SIGSEGV, Segmentation fault.
0x00000003f7ee8527 in cygboost_python-1_60!_ZTv0_n40_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_17bad_function_callEEEED1Ev ()
   from /usr/bin/cygboost_python-1_60.dll
(gdb)

如何开始排除故障?在

使用调试信息从源代码构建Python和/或Boost将是我最后的选择。在


Tags: 模块binstatus错误withprocessthreadat