导入错误 boost_python
Import errors with boost_python
当我尝试加载 boost::python 内置模块时,我在 Cygwin 上遇到了这些错误:
>>> import Whatever
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: Permission denied
我构建的其他模块(C 或 C++)没有此类错误。
这是我的最小模块:
#include <boost/python.hpp>
void whatever(){}
BOOST_PYTHON_MODULE(Whatever)
{
using namespace boost::python;
def("whatever", whatever);
}
我是这样构建的:
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 上运行过。
当我 运行 Python 到 strace
(在 Cygwin 上)时,我得到这个:
<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 and/or 使用调试信息从源代码提升是我最后的选择。
这似乎是 GCC 6.3.0 错误的结果。
最小复制:
#include <typeinfo>
int main()
{
typeid(int).name();
}
这个程序在 cygwin 下的 gcc 6.3.0 下出现段错误(无论如何在我的机器上)。
当我尝试加载 boost::python 内置模块时,我在 Cygwin 上遇到了这些错误:
>>> import Whatever
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: Permission denied
我构建的其他模块(C 或 C++)没有此类错误。
这是我的最小模块:
#include <boost/python.hpp>
void whatever(){}
BOOST_PYTHON_MODULE(Whatever)
{
using namespace boost::python;
def("whatever", whatever);
}
我是这样构建的:
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 上运行过。
当我 运行 Python 到 strace
(在 Cygwin 上)时,我得到这个:
<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 and/or 使用调试信息从源代码提升是我最后的选择。
这似乎是 GCC 6.3.0 错误的结果。
最小复制:
#include <typeinfo>
int main()
{
typeid(int).name();
}
这个程序在 cygwin 下的 gcc 6.3.0 下出现段错误(无论如何在我的机器上)。