简体   繁体   中英

Import errors with boost_python

I'm getting these errors on Cygwin when I try to load a boost::python built module:

>>> import Whatever
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: Permission denied

I don't have such errors for other modules I build (C or C++).

Here's my minimal module:

#include <boost/python.hpp>
void whatever(){}
BOOST_PYTHON_MODULE(Whatever)
{
    using namespace boost::python;
    def("whatever", whatever);
}

and I build it this way:

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

All .dlls involved have read and execute permissions.

I'm using only software installed by cygwin, nothing from binary or source packages. GCC version is 6.3.0 and Boost is 1.60.

Exactly the same configuration is working on Linux, and it used to work on Cygwin some time ago.

When I run Python through strace (on Cygwin), I get this:

<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

(that's the strace.exe itself crashing)

When I run it with gdb , I get this:

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)

How can I start troubleshooting it?

Building Python and/or Boost from source with debug information would be my last resort.

This appears to be consequence of a GCC 6.3.0 bug.

A minimal reproduction:

#include <typeinfo>

int main()
{
    typeid(int).name();
}

This program segfaults under gcc 6.3.0 under cygwin (on my machine at any rate).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM