This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年11月28日 11:29 by python_hu, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (11) | |||
|---|---|---|---|
| msg148474 - (view) | Author: python_hu (python_hu) | Date: 2011年11月28日 11:29 | |
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 <stdio.h>
#include "Python.h"
#include <dlfcn.h>
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 "<stdin>", line 1, in <module>
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.
>>>
|
|||
| msg148476 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2011年11月28日 13:06 | |
It may be related to issue941346. Can you try with a newer version of Python? 2.5 is not maintained anymore. |
|||
| msg148536 - (view) | Author: python_hu (python_hu) | Date: 2011年11月29日 02:43 | |
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
<invocation-command> [ <option> | <inputfile> ] ...
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,
:
|
|||
| msg148538 - (view) | Author: python_hu (python_hu) | Date: 2011年11月29日 02:50 | |
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. |
|||
| msg148543 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2011年11月29日 07:05 | |
Is the man page really displayed during compilation? It's a bit weird that the CC compiler behaves this way. Is this common behavior on AIX? By the way, you are already in the "make" command; the output you show is made during compilation of the "_ctypes" module, by the script Modules/_ctypes/libffi/configure. Can you try and see which part of the script displays the man page? |
|||
| msg148546 - (view) | Author: python_hu (python_hu) | Date: 2011年11月29日 08:02 | |
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 autoheader m4 python2.6 autom4te oraenv python2.6-config autoreconf pydoc python2.7 autoscan python python2.7-config autoupdate python-config smtpd.py coraenv python-config-bak tclsh8.4 dbhome python2.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; # |
|||
| msg148548 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2011年11月29日 08:29 | |
I'm sorry I don't know much about AIX. How are shared libraries searched? is /usr/local/lib a standard place for them? After a couple of google search I suggest the following command: LIBPATH=/usr/local/lib:/usr/lib python2.7 |
|||
| msg148649 - (view) | Author: python_hu (python_hu) | Date: 2011年11月30日 12:40 | |
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 <stdio.h>^M
#include "Python.h"^M
#include <dlfcn.h> ^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 0x900000000e23450 ($t1)
0x900000000e23450 (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 0x900000000e23450 ($t1)
0x900000000e23450 (pthread_kill+0xb0) e8410028 ld r2,0x28(r1)
(dbx) where
pthread_kill(??, ??) at 0x900000000e23450
_p_raise(??) at 0x900000000e22cc8
raise.raise(??) at 0x90000000002b10c
abort() at 0x900000000094544
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 = 0x0000000000000004), line 53 in "importdl.c"
import.load_module(name = "", fp = 0x0fffffffffffd8d8, buf = "^O377円377円377円377円377円316円p^I", type = 150994944, loader = 0x0000000110016e90), line 1830 in "import.c"
import.import_submodule(mod = 0x0900000005d0ebc4, subname = "", fullname = "^I"), line 2592 in "import.c"
import.load_next(mod = 0x0000000000000005, altmod = (nil), p_name = 0x0900000005dcba27, buf = "", p_buflen = 0x09001000a0b2f9d0), line 2412 in "import.c"
import.import_module_level(name = (nil), globals = 0x000000011008c328, locals = 0x000000011008c328, fromlist = 0x000000011013d608, level = -1), line 2133 in "import.c"
import.PyImport_ImportModuleLevel(name = "", globals = (nil), locals = 0x0900000005dcba20, fromlist = 0x09001000a0b2f9d0, level = 268435455), line 2185 in "import.c"
bltinmodule.builtin___import__(self = 0x0fffffffffffd970, args = 0x0000000000000060, kwds = 0x0fffffffffffd980), line 48 in "bltinmodule.c"
methodobject.PyCFunction_Call(func = 0x0fffffffffffd9f0, arg = 0x09001000a0b467d8, kw = 0x0fffffffffffda00), line 85 in "methodobject.c"
abstract.PyObject_Call(func = 0x0900000005cb9ae4, arg = 0x09001000a0b467d8, kw = 0x0fffffffffffda90), line 2492 in "abstract.c"
ceval.PyEval_CallObjectWithKeywords(func = 0x0000000000000004, arg = 0x00000001100992d0, kw = 0x000000011008c328), line 3619 in "ceval.c"
ceval.PyEval_EvalFrameEx(f = 0x0fffffffffffdda0, throwflag = 0), line 2159 in "ceval.c"
ceval.PyEval_EvalCodeEx(co = (nil), globals = 0x000000011000ca50, locals = 0x0fffffffffffdee4, args = 0x000000011019a740, argcount = 1, kws = 0x09001000a0075420, kwcount = -1159983106, defs = 0xbadc0ffee0ddf00d, defcount = 0, closure = (nil)), line 3000 in "ceval.c"
ceval.PyEval_EvalCode(co = 0x0900000005d578cc, globals = 0x488842281006e148, locals = (nil)), line 541 in "ceval.c"
pythonrun.run_mod(mod = 0x0fffffffffffdff0, filename = "^I377円377円377円360円", globals = 0x0900000000028c20, locals = 0x09001000a0b467d8, flags = 0xbadc0ffee0ddf00d, arena = 0x09001000a0075420), line 1351 in "pythonrun.c"
pythonrun.PyRun_StringFlags(str = "350円A", start = -1159983106, globals = 0xbadc0ffee0ddf00d, locals = 0xbadc0ffee0ddf00d, flags = 0xbadc0ffee0ddf00d), line 1314 in "pythonrun.c"
pythonrun.PyRun_SimpleStringFlags(command = "sucess!", flags = 0x0000000000000001), line 967 in "pythonrun.c"
main.main(argc = 1, argv = 0x0fffffffffffe190), line 42 in "main.cpp"
(dbx)
---------------------------------------
the line 38 in "modsupport.c":
if (!Py_IsInitialized())
Py_FatalError("Interpreter not initialized (version mismatch?)");
it looks like "Py_IsInitialized()" is false,but in my main(),the "Py_IsInitialized()" return true.
|
|||
| msg148651 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2011年11月30日 12:59 | |
> dlopen("/usr/local/lib/python2.6/lib-dynload/time.so", 2);
You are trying to open a .so from another Python installation.
It won't work: it is certainly linked to another Python VM, which is not initialized.
|
|||
| msg148714 - (view) | Author: python_hu (python_hu) | Date: 2011年12月01日 08:37 | |
-> 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.
|
|||
| msg342547 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2019年05月15日 03:04 | |
No activity since 2011, I close the issue. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:24 | admin | set | github: 57702 |
| 2019年05月15日 03:04:36 | vstinner | set | status: open -> closed nosy: + vstinner messages: + msg342547 resolution: out of date stage: test needed -> resolved |
| 2014年06月02日 15:01:25 | haubi | set | nosy:
+ haubi |
| 2011年12月01日 08:37:23 | python_hu | set | messages: + msg148714 |
| 2011年11月30日 12:59:42 | amaury.forgeotdarc | set | messages: + msg148651 |
| 2011年11月30日 12:40:19 | python_hu | set | messages: + msg148649 |
| 2011年11月29日 08:29:15 | amaury.forgeotdarc | set | messages: + msg148548 |
| 2011年11月29日 08:02:24 | python_hu | set | messages: + msg148546 |
| 2011年11月29日 07:05:38 | amaury.forgeotdarc | set | messages: + msg148543 |
| 2011年11月29日 02:50:18 | python_hu | set | messages: + msg148538 |
| 2011年11月29日 02:43:35 | python_hu | set | messages: + msg148536 |
| 2011年11月28日 15:10:52 | eric.araujo | set | title: using python embed on AIX 6.1,Modules import error! -> Import error with embedded python on AIX 6.1 stage: test needed type: crash -> behavior components: - None versions: + Python 2.7, - Python 2.6 |
| 2011年11月28日 13:06:14 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg148476 |
| 2011年11月28日 11:29:13 | python_hu | create | |