[issue13493] using python embed on AIX 6.1,Modules import error!

2011-11-28 Thread python_hu

New submission from python_hu :

Using python api embed on AIX 6.1,Modules import error,need help!
I have compile Python2.5.5 on Aix 6.1 using condigure:
 ./configure --with-gcc="xlc_r -q64" --with-cxx="xlC_r -q64" --disable-ipv6 
AR="ar -X64"
when i run Python,and import math module,it works well:

ibm1:python2.5>python
Python 2.5.5 (r255:77872, Nov 28 2011, 13:32:10) [C] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> 

But when i using in my C++ program,it works erro,the follow is mt code :
//{{C++

#include 
#include "Python.h"
#include  

int main( int argc, char **argv )
{
 Py_Main(argc, argv); 
}

//}}

When i run this code.it has erro like that:
ibm1:pytest>pytest
Python 2.5.5 (r255:77872, Nov 28 2011, 13:32:10) [C] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
_PyImport_GetDynLoadFunc142:/usr/local/lib/python2.5/lib-dynload/math.so,flags=2_
_PyImport_GetDynLoadFunc_erro:/usr/local/lib/python2.5/lib-dynload/math.so
Traceback (most recent call last):
  File "", line 1, in 
ImportError:0509-130 Symbol resolution failed 
/usr/local/lib/python2.5/lib-dynload/math.so because:
0509-136   Symbol PyArg_Parse (number 0) is not exported from
   dependent module pytest.
0509-136   Symbol PyArg_ParseTuple (number 1) is not exported from
   dependent module pytest.
0509-136   Symbol Py_BuildValue (number 2) is not exported from
   dependent module pytest.
0509-136   Symbol PyDict_GetItemString (number 3) is not exported from
   dependent module pytest.
0509-136   Symbol PyErr_NoMemory (number 4) is not exported from
   dependent module pytest.
0509-136   Symbol PyErr_Occurred (number 5) is not exported from
   dependent module pytest.
0509-021 Additional errors occurred but are not reported.
    0509-192 Examine .loader section symbols with the
 'dump -Tv' command.

>>>

--
components: None
messages: 148474
nosy: python_hu
priority: normal
severity: normal
status: open
title: using python embed on AIX 6.1,Modules import error!
type: crash
versions: Python 2.6

___
Python tracker 
<http://bugs.python.org/issue13493>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13493] Import error with embedded python on AIX 6.1

2011-11-28 Thread python_hu

python_hu  added the comment:

thanks a lot. as your surggest,i try python2.7.2,but when i build it on AIX 
6.1, it can not compile success,breaked by xlc_c console. 
Informations:


checking size of double... 8
checking size of long double... 8
checking whether byte ordering is bigendian... yes
checking assembler .cfi pseudo-op support... no
checking whether .eh_frame section should be read-only... no
checking for __attribute__((visibility("hidden")))... no
xlc_r: 1501-210 (W) command option t contains an incorrect subargument



  xlc(1) IBM (2008)  xlc(1)



  NAME
 xlc, xlc++, xlC, cc, c89, c99, xlCcore, xlc++core and
 related commands - invoke the IBM XL C/C++ compiler.


  SYNTAX
  [  |  ] ...


  DESCRIPTION
 The invocation commands compile C and C++ source files.
 The commands and their recommended uses are described
 below.

 Invocations   Usage (supported standards)
 _

 xlc, xlc_r, xlc_r4,   Compile C source files.
 xlc_r7, xlc128, xlc128_r, (ANSI C89, ISO C99,
 xlc128_r4, xlc128_r7  IBM language extensions)

 xlc++, xlc++_r, xlc++_r4, Compile C++ source files.
 xlc++_r7, xlc++128,
 xlc++128_r, xlc++128_r4,
 xlc++128_r7, xlC, xlC_r,
 xlC_r4, xlC_r7, xlC128,
 xlC128_r, xlC128_r4,
:

--

___
Python tracker 
<http://bugs.python.org/issue13493>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13493] Import error with embedded python on AIX 6.1

2011-11-28 Thread python_hu

python_hu  added the comment:

By the way,i have compared the "configure.in" with Python-2.7_shared_AIX.diff 
in Issue941346,and can not find any modification of building share library on 
AIX in Python 2.7.2' source code.

--

___
Python tracker 
<http://bugs.python.org/issue13493>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13493] Import error with embedded python on AIX 6.1

2011-11-29 Thread python_hu

python_hu  added the comment:

Sorry,it just a common behave of xlC_r,we can ignore it.

So i sucess build libpython2.7.so using --enable-shared:

./configure --enable-shared --with-gcc="xlc_r -q64" --with-cxx="xlC_r -q64" 
--disable-ipv6 AR="ar -X64"

I make install python2.7.2,but when i run python2.7,it crashed. why  python2.7 
can not load libpython2.7.so? libpython2.7.so has been installed at 
/usr/local/lib

informations:


# ls
2to3  idle  python2.5-config
autoconf  ifnames   python2.5-config-bak
autoheaderm4python2.6
autom4te  oraenvpython2.6-config
autoreconfpydoc python2.7
autoscan  pythonpython2.7-config
autoupdatepython-config smtpd.py
coraenv   python-config-bak tclsh8.4
dbhomepython2.5 wish8.4
# python2.7
exec():509-036 can not load program python2.7 because of
0509-150 can not load sub module libpython2.7.so
0509-022 can not load  libpython2.7.so
0509-026 system erro: file or dir do noe exists;
#

--

___
Python tracker 
<http://bugs.python.org/issue13493>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13493] Import error with embedded python on AIX 6.1

2011-11-30 Thread python_hu

python_hu  added the comment:

Thank Amaury,you are right.
So python2.7 share library compile finished,and python2.7 works,and then
I write a test program,to test libpython2.7.so share library,but it dumped!

code:
---
#include ^M
#include "Python.h"^M
#include  ^M
^M
int main( int argc, char **argv )^M
{^M

 Py_Initialize(); 
if(!Py_IsInitialized())
{
printf("py initialized fail!");
return -1;
}

void* handle = dlopen("/usr/local/lib/python2.6/lib-dynload/time.so", 2);
if (handle == NULL) {
   const char *error = dlerror();
   if (error == NULL)
error = "unknown dlopen() error";
   printf("erro=%s\n",error);
  return NULL;
}
if(!Py_IsInitialized())
{
printf("py initialized fail!");
return -1;
}

printf("hi,python!\n");

PyRun_SimpleString("from time import time,ctime\nprint 'Today 
is',ctime(time())\n");

Py_Finalize();
}


This code can compile sucess,but run core dump:

ibm1:mmi>pytest
hi,python!
Fatal Python error: Interpreter not initialized (version mismatch?)

The core dump file:
-
IOT/Abort trap in pthread_kill at 0x9e23450 ($t1)
0x9e23450 (pthread_kill+0xb0) e8410028  ld   r2,0x28(r1)
(dbx) run
hi,python!
Fatal Python error: Interpreter not initialized (version mismatch?)

IOT/Abort trap in pthread_kill at 0x9e23450 ($t1)
0x9e23450 (pthread_kill+0xb0) e8410028  ld   r2,0x28(r1)
(dbx) where
pthread_kill(??, ??) at 0x9e23450
_p_raise(??) at 0x9e22cc8
raise.raise(??) at 0x902b10c
abort() at 0x9094544
pythonrun.Py_FatalError(msg = "init%.200s"), line 1675 in "pythonrun.c"
modsupport.Py_InitModule4_64(name = (nil), methods = 0x09001000a0b467d8, doc = 
(invalid char ptr (0x2f7573722f6c6f63)), passthrough = 0x616c2f6c69622f70, 
module_api_version = 0), line 38 in "modsupport.c"
inittime(), line 825 in "timemodule.c"
importdl._PyImport_LoadDynamicModule(name = (nil), pathname = "", fp = 
0x0004), line 53 in "importdl.c"
import.load_module(name = "", fp = 0x0fffd8d8, buf = 
"^O\377\377\377\377\377\316p^I", type = 150994944, loader = 
0x000110016e90), line 1830 in "import.c"
import.import_submodule(mod = 0x090005d0ebc4, subname = "", fullname = 
"^I"), line 2592 in "import.c"
import.load_next(mod = 0x0005, altmod = (nil), p_name = 
0x090005dcba27, buf = "", p_buflen = 0x09001000a0b2f9d0), line 2412 in 
"import.c"
import.import_module_level(name = (nil), globals = 0x00011008c328, locals = 
0x00011008c328, fromlist = 0x00011013d608, level = -1), line 2133 in 
"import.c"
import.PyImport_ImportModuleLevel(name = "", globals = (nil), locals = 
0x090005dcba20, fromlist = 0x09001000a0b2f9d0, level = 268435455), line 
2185 in "import.c"
bltinmodule.builtin___import__(self = 0x0fffd970, args = 
0x0060, kwds = 0x0fffd980), line 48 in "bltinmodule.c"
methodobject.PyCFunction_Call(func = 0x0fffd9f0, arg = 
0x09001000a0b467d8, kw = 0x0fffda00), line 85 in "methodobject.c"
abstract.PyObject_Call(func = 0x090005cb9ae4, arg = 0x09001000a0b467d8, kw 
= 0x0fffda90), line 2492 in "abstract.c"
ceval.PyEval_CallObjectWithKeywords(func = 0x0004, arg = 
0x0001100992d0, kw = 0x00011008c328), line 3619 in "ceval.c"
ceval.PyEval_EvalFrameEx(f = 0x0fffdda0, throwflag = 0), line 2159 in 
"ceval.c"
ceval.PyEval_EvalCodeEx(co = (nil), globals = 0x00011000ca50, locals = 
0x0fffdee4, args = 0x00011019a740, argcount = 1, kws = 
0x09001000a0075420, kwcount = -1159983106, defs = 0xbadc0ffee0ddf00d, defcount 
= 0, closure = (nil)), line 3000 in "ceval.c"
ceval.PyEval_EvalCode(co = 0x090005d578cc, globals = 0x488842281006e148, 
locals = (nil)), line 541 in "ceval.c"
pythonrun.run_mod(mod = 0x0fffdff0, filename = "^I\377\377\377\360", 
globals = 0x09028c20, locals = 0x09001000a0b467d8, flags = 
0xbadc0ffee0ddf00d, arena = 0x09001000a0075420), line 1351 in "pythonrun.c"
pythonrun.PyRun_StringFlags(str = "\350A", start = -1159983106, globals = 
0xbadc0ffee0ddf00d, locals = 0xbadc0ffee0ddf00d, flags = 0xbadc0ffee0ddf00d), 
line 1314 in "pythonrun.c"
pythonrun.PyRun_SimpleStringFlags(command = "sucess!", flags = 
0x0001), line 967 in "pythonrun.c"
main.main(argc = 1, argv = 0x0fffe190), line 42 in "main.cpp"
(dbx) 
---
the line 38 in "modsuppor

[issue13493] Import error with embedded python on AIX 6.1

2011-12-01 Thread python_hu

python_hu  added the comment:

-> void* handle = dlopen("/usr/local/lib/python2.7/lib-dynload/time.so", 2);
this code can work well,but when the code run to :
PyRun_SimpleString("from time import time,ctime\nprint 'Today 
is',ctime(time())\n");

it dumped, i think it make be because of there are two python handle 
running,one is main thread ,anthother is the  time.so.

--

___
Python tracker 
<http://bugs.python.org/issue13493>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com