I'm trying to get python to load dynamic modules.
But after loading the module, when code inside
the module calls back into the main program,
it seg faults. More details below.
Anybody have any ideas what could cause this?
At one point, I believe this worked. It's possible
the machines aren't configured properly or don't
have the necessary patches.
Currently, the interpreter builds and seems to work fine.
However, it can't load modules. Well, actually it can
load modules, but as soon as the module calls a python
utility (an API in libpython), it seg faults.
Specifically (I cleaned the lines up and took out some stuff):
neal at dupont [~/python/dist/src]$ make
# snip line
building 'struct' extension
gcc -g -c Modules/structmodule.c
./Modules/ld_so_aix gcc -bI:Modules/python.exp structmodule.o \
-L/usr/local/lib -o build/lib.aix-4.3-2.3/struct.so
gcc -Wl,-einitstruct -Wl,-bE:struct.exp -Wl,-bI:Modules/python.exp \
-Wl,-bhalt:4 -Wl,-bM:SRE -Wl,-T512 -Wl,-H512 -lm \
-o build/lib.aix-4.3-2.3/struct.so \
./python -c 'import struct'
make: *** [sharedmods] Segmentation fault
gcc version is 3.2. I tried xlc, but got the same results. I think
xlc's version is 126.96.36.199 (5765-C6400). My LIBPATH was empty. I also
set LIBPATH to the directory where libpython2.3.a lives, but it
This is on AIX 188.8.131.52, but I've had the problem on 4.3.3.x and 184.108.40.206.
Here's some more details:
#0 0xd009be70 in Py_InitModule4TraceRefs ()
#1 0xd009ac3c in initstruct ()
#2 0x101182e0 in _PyImport_LoadDynamicModule (name=0x2026d70c "struct",
pathname=0x20161594 "build/lib.aix-4.3-2.3/struct.so", fp=0x0)
This indicates that the dynamic load of struct.so was successful. (#2)
The call to initstruct() in struct.so was successful. (#1) But
inside the module, when we try to call Py_InitModule4TraceRefs()
(or Py_InitModule in the code), it crashes. I don't know why.