[mod_python] make failed on AIX 5.1 using xlc

Graham Dumpleton grahamd at dscpl.com.au
Tue Jan 10 16:54:54 EST 2006


Hans-Joachim Ehlers wrote ..
> >Find where '-El,-bE' is defined in the Python installed Makefile and
> >email back that line and the few either side of it.
> I think you mean : '-Wl,bE' This option is set with the   LINKFORSHARED
> Variable
> See extract from Makefile and configure.in 
> BTW: The python tarball has a ./Python-2.4.2/Modules/python.exp
> 
> Shell i open a bug with the python group ?

Possibly not.

What I would suggest first is that you find a Python extension module off
the net that has both a C code component and a Python component and
which uses distutils module for installation. These are ones which usually
have a "setup.py" file. Since you are doing web stuff, maybe you should
try Cheetah.

Try and install the module, if the configuration in that Python installed
Makefile, which is also consulted by distutils module for installation,
causes the compilation of the C component of the Python package being
built to fail, then it would an issue which is possibly reported to main
Python developers, or at least sorted out on Python news group or
mailing list as to what is wrong as at that point it would be independent
of mod_python.

If the C component of the Python package builds okay, then it is more
likely how mod_python is using the information in that Python Makefile
that is the problem.

Specifically, the "configure" script of mod_python contains:

  PyLFS=`grep "^LINKFORSHARED=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' '   '`
  PyLDFLAGS=`grep "^LDFLAGS=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' '   '`
  LDFLAGS="${LDFLAGS} ${PyLFS} ${PyLDFLAGS}"
  LDFLAGS="${LDFLAGS} ${PY_LDFLAGS}"

Thus, it is extracted LINKFORSHARED out of the Python Makefile and used
it to construct the LDFLAGS for the generated mod_python Makefile.

As much as one could make mod_python handle it, am not sure it is
worth the trouble. I would simply suggest that after you run 'configure'
that you edit the generated makefile, probably 'src/Makefile' and delete
the '-Wl,-bE:Modules/python.exp' option from it.

Similar situation for the function cast you had to change in requestobject.c.
It just becomes to much of a pain to try and deal with the strangeness of
lessor used compilers.

Graham

> Regarding:
> 
> >> but still compiles
> >
> > If that is the line:
> >   static int yy_init_globals (yyscan_t yyscanner ) {return 0;};
> 
> Yes it is this line 
> 
> >
> > it is because of the extraneous semicolon on the end of the line.
> From
> >memory, both AIX C compiler and Sun C++ compiler would complain about
> > such extra semicolons.
> 
> So i can ignore the error message or do i have to change that line ?
> 
> regards
> Hajo
> 
> 
> >From /usr/local/lib/python/config/Makefile ( +NNN means line No. )
> 
>    +34  LINKCC=         $(srcdir)/Modules/makexp_aix Modules/python.exp
> . $(LIBRARY); $(PURIFY) $(CC)
> 
>    +56  # Compiler options
>    +57  OPT=            -O
>    +58  BASECFLAGS=
>    +59  CFLAGS=         $(BASECFLAGS) $(OPT)
>    +60  CPPFLAGS=       -I. -I$(srcdir)/Include
>    +61  LDFLAGS=        -L/opt/freeware/lib -ltk8.3 -ltcl8.3
>    +62  LDLAST=
>    +63  SGI_ABI=
>    +64  CCSHARED=
>    +65  LINKFORSHARED=  -Wl,-bE:Modules/python.exp -lld
>    +66  # Extra C flags added for building the interpreter object
> files.
>    +67  CFLAGSFORSHARED=
>    +68  # C flags used for building the interpreter object files
>    +69  PY_CFLAGS=      $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED)
> -DPy_BUILD_CORE
>    +70
> 
>    +96  # Symbols used for using shared libraries
>    +97  SO=             .so
>    +98  LDSHARED=       $(BINLIBDEST)/config/ld_so_aix $(CC)
> -bI:$(BINLIBDEST)/config/python.exp
>    +99  BLDSHARED=      $(srcdir)/Modules/ld_so_aix $(CC)
> -bI:Modules/python.exp
> 
>   +326  # Build the interpreter
>   +327  $(BUILDPYTHON): Modules/$(MAINOBJ) $(LIBRARY) $(LDLIBRARY)
>   +328                  $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
>   +329                          Modules/$(MAINOBJ) \
>   +330                          $(BLDLIBRARY) $(LIBS) $(MODLIBS)
> $(SYSLIBS) $(LDLAST)
> 
> Extract from the Python configure.in
> ...
> # This is altered for AIX in order to build the export list before
> # linking.
> AC_SUBST(LINKCC)
> AC_MSG_CHECKING(LINKCC)
> if test -z "$LINKCC"
> then
> ....
>         AIX*)
>            exp_extra="\"\""
>            if test $ac_sys_release -ge 5 -o \
>                    $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
>                exp_extra="."
>            fi
>            LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp
> $exp_extra \$(LIBRARY); $LINKCC";;
> ....
> fi
> ....
> # Python, as opposed to building Python itself as a shared library.)
> AC_MSG_CHECKING(LDSHARED)
> if test -z "$LDSHARED"
> then
>         case $ac_sys_system/$ac_sys_release in
>         AIX*)
>                 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC)
> -bI:Modules/python.exp"
>                 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC)
> -bI:\$(BINLIBDEST)/config/python.exp"
>                 ;;
> .....
> # LINKFORSHARED are the flags passed to the $(CC) command that links
> # the python executable -- this is only needed for a few systems
> AC_MSG_CHECKING(LINKFORSHARED)
> if test -z "$LINKFORSHARED"
> then
>         case $ac_sys_system/$ac_sys_release in
>         AIX*)   LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
> .....
> 
> 
> 
> 
> 
> 
> >>> Graham Dumpleton <grahamd at dscpl.com.au> 10/01/06 11:33 >>>
> 
> On 10/01/2006, at 9:18 PM, Hans-Joachim Ehlers wrote:
> 
> > 2)
> > Under AIX the Compilation of python is somehow quite uncommon
> > Just see the out from from the mod_python make:
> >
> > /usr/local/apache2/build/libtool --silent --mode=link xlc_r -o
> > mod_python.la  -rpath /usr/local/apache2/modules -module
> -avoid-version
> > -Wl,-brtl  hlistobject.lo hlist.lo filterobject.lo connobject.lo
> > serverobject.lo util.lo tableobject.lo requestobject.lo 
> > _apachemodule.lo
> > mod_python.lo -L/usr/local/lib/python2.4/config
> > -Wl,-bE:Modules/python.exp -lld -L/opt/freeware/lib -ltk8.3 -ltcl8.3
> 
> > -lm
> > -lpython2.4 -ldl -lm
> > ld: 0706-004 Cannot find or read export file: Modules/python.exp
> >
> > These ./python.exp can be found as
> > /usr/local/lib/python2.4/config/python.exp in the installed python
> > distribution
> > So the Makefile for Modpython should have a Section for AIX where
> the
> > makefile does the following:
> > Get the python installation directory ( in my case
> > /usr/local/lib/python2.4 )
> > Create a Subdirectory in ./src for Modules ( mkdir Modules )
> > Creates a Link in ./src/Modules to
> > /usr/local/lib/python2.4/config/python.exp
> >
> > OR
> > just makes mkdir ./src/Modules && touch ./src/Modules/python.exp
> >
> > I have tested both without problems but i would prefer the first
> one.
> 
> Look at /usr/local/lib/python2.4/config/Makefile. The mod_python
> makefile is most likely getting the '-Wl,-bE:Modules/python.exp'
> out of there.
> 
> Either one of two things might be wrong. First might be that the
> option is exactly that and therefore that Makefile in Python is wrong.
> 
> Second thing that might be wrong is that the option is actually
> written as '-El,-bE:$(DESTDIR)$(LIBPL)/python.exp' and that is what
> mod_python is using but DESTDIR and LIBPL aren't actually set and
> thus are being replaced with nothing.
> 
> If the latter, one might argue that mod_python could set one or both
> of these variables in its makefile somehow to ensure they are expanded
> correctly.
> 
> Find where '-El,-bE' is defined in the Python installed Makefile and
> email back that line and the few either side of it.
> 
> > After that i get from a make:
> > xlc_r -O -Isrc/include -I/usr/local/include/python2.4 -c
> > src/_pspmodule.c -o build/temp.aix-5.1-2.4/src/_pspmodule.o
> > "src/_pspmodule.c", line 32.61: 1506-137 (E) Declaration must
> declare
> > at least one declarator, tag, or the members of an enumeration.
> >
> > but still compiles
> 
> If that is the line:
> 
>    static int yy_init_globals (yyscan_t yyscanner ) {return 0;};
> 
> it is because of the extraneous semicolon on the end of the line. From
> memory, both AIX C compiler and Sun C++ compiler would complain about
> such extra semicolons.
> 
> > A make install will pass with out any error
> > I would like to provide a patch file for the Makefile but i am a
> totaly
> > newbe to C programming and building so i hope the above information 
> > will
> > help
> >
> > No runtime testing has been done yet
> >
> > With kind regards
> > Hajo
> >
> >
> >>>> "Graham Dumpleton" <grahamd at dscpl.com.au> 09/01/06 22:38 >>>
> > Seems to be some quirk with xlc compiler. Never liked that compiler,
> > always did strange things.
> >
> > Try hacking the code so that instead of:
> >
> >   (destructor)request_dealloc,     /* tp_free */
> >
> > it says:
> >
> >   (void(*)(void*))request_dealloc,     /* tp_free */
> >
> > Try a typedef for the function pointer if I got the cast wrong or it
> > doesn't want to accept that.
> >
> > Graham
> >
> > Hans-Joachim Ehlers wrote ..
> >> Hi folk,
> >> i am trying to build mod-python 3.1.4 on AIX 5.1 with xlc
> >> During the gmake i get the following error: .... 1506-196 (E)
> >> Initialization between types "void(*)(void*)" and "void(*)(struct
> >> _object*)" is not allowed
> >>
> >> any Tips ?
> >> tai
> >> Hajo
> >>
> >> For details see below
> >>
> >> given:
> >> AIX 5.1
> >> vac 6.0 ( IBM xlc)
> >> mod-python 3.1.4
> >> Python 2.4.2 build as shared Lib application
> >> Apache 2.0.55
> >>
> >> $ ./configure CC=xlc_r \
> >>  --with-thread       \
> >>  --with-python=/usr/local/bin/python \
> >>  --with-apxs=/usr/local/apache2/bin/apxs
> >>
> >>
> >> $ gmake[1]: Entering directory
> >> `/homespace/hjehlers/workbench/modpython/mod_python-3.1.4/src'
> >>
> >> Compiling for DSO.
> >>
> >> /usr/local/apache2/bin/apxs
> >>
> >
> -I/homespace/hjehlers/workbench/modpython/mod_python-3.1.4/src/include
> >> -I/usr/local/apache2/include -I/usr/local/include/python2.4 -c
> >> mod_python.c _apachemodule.c requestobject.c tableobject.c util.c
> >> serverobject.c connobject.c filterobject.c hlist.c hlistobject.c
> >> -L/usr/local/lib/python2.4/config  -Wl,-bE:Modules/python.exp -lld
> >> -L/opt/freeware/lib -ltk8.3 -ltcl8.3    -lm  -lpython2.4   -ldl
> > -lm
> >> /usr/local/apache2/build/libtool --silent --mode=compile xlc_r
> >> -prefer-pic   -U__STR__ -D_THREAD_SAFE -D_USE_IRS -DAP_DEBUG -g
> > -qHALT=E
> >> -qfullpath -qinitauto=FE -qcheck=all -qinfo=pro
> >> -I/usr/local/apache2/include  -I/usr/local/apache2/include
> >> -I/usr/local/apache2/include
> >>
> >
> -I/homespace/hjehlers/workbench/modpython/mod_python-3.1.4/src/include
> >> -I/usr/local/apache2/include -I/usr/local/include/python2.4  -c -o
> >> mod_python.lo mod_python.c && touch mod_python.slo
> >> /usr/local/apache2/build/libtool --silent --mode=compile xlc_r
> >> -prefer-pic   -U__STR__ -D_THREAD_SAFE -D_USE_IRS -DAP_DEBUG -g
> > -qHALT=E
> >> -qfullpath -qinitauto=FE -qcheck=all -qinfo=pro
> >> -I/usr/local/apache2/include  -I/usr/local/apache2/include
> >> -I/usr/local/apache2/include
> >>
> >
> -I/homespace/hjehlers/workbench/modpython/mod_python-3.1.4/src/include
> >> -I/usr/local/apache2/include -I/usr/local/include/python2.4  -c -o
> >> _apachemodule.lo _apachemodule.c && touch _apachemodule.slo
> >> /usr/local/apache2/build/libtool --silent --mode=compile xlc_r
> >> -prefer-pic   -U__STR__ -D_THREAD_SAFE -D_USE_IRS -DAP_DEBUG -g
> > -qHALT=E
> >> -qfullpath -qinitauto=FE -qcheck=all -qinfo=pro
> >> -I/usr/local/apache2/include  -I/usr/local/apache2/include
> >> -I/usr/local/apache2/include
> >>
> >
> -I/homespace/hjehlers/workbench/modpython/mod_python-3.1.4/src/include
> >> -I/usr/local/apache2/include -I/usr/local/include/python2.4  -c -o
> >> requestobject.lo requestobject.c && touch requestobject.slo
> >> "requestobject.c", line 1381.5: 1506-196 (E) Initialization between
> >> types "void(*)(void*)" and "void(*)(struct _object*)" is not
> > allowed.
> >> apxs:Error: Command failed with rc=65536
> >> .
> >> gmake[1]: *** [mod_python.so] Error 1
> >> gmake[1]: Leaving directory
> >> `/homespace/hjehlers/workbench/modpython/mod_python-3.1.4/src'
> >> gmake: *** [do_dso] Error 2
> >>
> >> _______________________________________________
> >> Mod_python mailing list
> >> Mod_python at modpython.org 
> >> http://mailman.modpython.org/mailman/listinfo/mod_python 


More information about the Mod_python mailing list