[C++-sig] V2: Segmentation fault with gcc-2.95.4 but not with gcc-3.0.4
Pearu Peterson
pearu at cens.ioc.ee
Fri Apr 19 00:44:21 CEST 2002
Hi!
I am getting segmentation faults when trying to import gcc-2.95.4
compiled extension module (the source is included at the end of this
message) while gcc-3.0.4 compiled module works fine. I am using latest BPL
V2 from CVS on Debian Woody, Python 2.2.1c. gdb shows
(gdb) run
Starting program: /usr/bin/python2.2
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...[New Thread 1024 (LWP 5716)]
(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
Python 2.2.1c1 (#1, Mar 15 2002, 08:13:47)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(no debugging symbols found)...(no debugging symbols found)...
>>> import gs1
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 5716)]
0x400ce64b in PyModule_Type () from /usr/lib/libpython2.2.so.0.0
Compilation flags for gcc:
-DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -ftemplate-depth-20
Compiling with gcc, linking with g++.
Any ideas?
Note that I would not mind using gcc-3.x but then for my application I
would need to recompile a bunch of libraries (ginac,cln) that otherwise
come with the distribution and are compiled with gcc-2.95.4. Therefore, I
would first like to try to get BPL V2 working with gcc-2.95.x, if
possible.
Thanks,
Pearu
// File gs1.cpp
#include <string>
#define BOOST_PYTHON_DYNAMIC_LIB
#define BOOST_PYTHON_V2
#include <boost/python/module.hpp>
namespace {
std::string greet() { return "hello, world"; }
int square(int number) { return number * number; }
}
BOOST_PYTHON_MODULE_INIT(gs1)
{
using namespace boost::python;
module m("gs1");
m
.def("greet", greet)
.def("square", square)
;
}
More information about the Cplusplus-sig
mailing list