Compilation problem of Python2.5.1 on AIX5.2 (with --enable-shared option)

YIN Ming Ming.YIN at murex.com
Wed Apr 16 06:47:19 EDT 2008


Dear All,

 

I encountered a problem when compiling Python2.5.1 as shared library on
AIX5.2. Your help are greatly appreciated.

 

In order to embed python into our product, we want to compile python as
shared library.  It works for Solaris and Linux. Unfortunately, It is
for AIX and I could not find solution from Web. Could you help answer
the following questions:

 

Is it feasible to compile python2.5.1 as shared library for AIX5.2? 

or where can I find relevant documentation/info for this?

 

 

So far, the only documents I have are the README and Misc/AIX-NOTES in
the source distribution

The step I tried to compile python as shared library is to follow
README, section "Building a shared libpython", which suggests to add
--enable-shared during configuration.

 

My problem is that with --enable-shared, the make step could not
complete (the error message shows it tries to refer to "-lpython2.5" in
a wrong directory).  Then if I refer it to the correct directory (which
is compiled in source root), some warning messages show duplicated
symbols. And finally I just remove "-lpython2.5", the make could finish
but the resulting python interpreter is a statically-linked binary. (The
detail is shown below).

 

 

The detail of my compilation

 

1.	CC="cc_r" ./configure --prefix=/src/new/python2/install
--without-gcc --disable-ipv6 --enable-shared 
2.	make CC="cc_r" OPT="-O -qmaxmem=4000" 

 

An error occurred when compiling python extensions.

...

running build

running build_ext

INFO: Can't locate Tcl/Tk libs and/or headers

building '_struct' extension

creating build

...

cc_r -DNDEBUG -O -I.
-I/vega5/prod/src/new/python2/Python-2.5.1/./Include -I./In

clude -I. -I/usr/local/include
-I/vega5/prod/src/new/python2/Python-2.5.1/Includ

e -I/vega5/prod/src/new/python2/Python-2.5.1 -c
/vega5/prod/src/new/python2/Pyth

on-2.5.1/Modules/_struct.c -o
build/temp.aix-5.2-2.5/vega5/prod/src/new/python2/

Python-2.5.1/Modules/_struct.o

creating build/lib.aix-5.2-2.5

./Modules/ld_so_aix cc_r -bI:Modules/python.exp
build/temp.aix-5.2-2.5/vega5/pro

d/src/new/python2/Python-2.5.1/Modules/_struct.o -L/usr/local/lib
-lpython2.5 -o

 build/lib.aix-5.2-2.5/_struct.so

ld: 0706-006 Cannot find or open library file: -l python2.5

        ld:open(): No such file or directory

*** WARNING: renaming "_struct" since importing it failed: No such file
or directory

error: No such file or directory

make: The error code from the last command is 1.

 

The highlighted command tries to locate the pyhton2.5 lib in
/usr/local/lib, which obviously does not contain this lib.

 

A library, libpython2.5.a, has already been compiled in the root build
directory.

 

1) First, I try to add "-L." to the command

./Modules/ld_so_aix cc_r -bI:Modules/python.exp
build/temp.aix-5.2-2.5/vega5/prod/src/new/python2/Python-2.5.1/Modules/_
struct.o  -L/usr/local/lib -L.

 -lpython2.5 -o  build/lib.aix-5.2-2.5/_struct.so

 

It could find but with a lot of warning messages like:

ld: 0711-224 WARNING: Duplicate symbol: PyObject_GenericGetAttr

ld: 0711-224 WARNING: Duplicate symbol: .PyObject_GenericGetAttr

ld: 0711-224 WARNING: Duplicate symbol: ._Py_ReadyTypes 

...

 

2) Second, I try to remove "-L/usr/local/lib -lpython2.5" from the
command

./Modules/ld_so_aix cc_r -bI:Modules/python.exp
build/temp.aix-5.2-2.5/vega5/prod/src/new/python2/Python-2.5.1/Modules/_
struct.o  -o  build/lib.aix-5.2-2.5/_struct.so

 

It complete without any warning message.

 

As a result, I filter out all "-lpython2.5" passed to
./Modules/ld_so_aix for the rest commands. In this way, the python
interpreter was generated. However, it is a big executable and "ldd
python" does not show it depends on any python shared library (It seems
no shared python library generated). It has no difference from the one
compiled without --enable-shared.

 

Note that if the configuration is run without --enable-shared option,
the corresponding commands will not contain "-lpython2.5".

 

Best regards,

Yin Ming 
 
 
--------------------------------------------------------

 This e-mail contains information for the intended recipient only.  It may contain proprietary material or confidential information.  If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it.  Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use.  If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080416/6746980e/attachment.html>


More information about the Python-list mailing list