[mod_python] wrong version?

Graham Dumpleton graham.dumpleton at gmail.com
Tue Apr 8 22:35:17 EDT 2008


2008/4/9 Kyle Simpson <kyle.simpson at gmail.com>:
> Yes there are header files in /usr/local/apache28/include
>
> Value is: #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
>
> In older version, it is:
>
> #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */

But that is the same, so how can it be an older version, unless it
differs only by patch level. The magic string it complains about is
for Apache 2.0 so you must have that installed somewhere.

> How do you determine the -l flags when the compiler is run?

I gave an example:

/usr/local/apache-2.2.4/bin/apxs
-I/Users/grahamd/Projects/mod_python-trunk/src/include
-I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
-DNDEBUG -Wc,'-arch ppc' -c mod_python.c _apachemodule.c
requestobject.c tableobject.c util.c serverobject.c connobject.c
filterobject.c hlist.c hlistobject.c finfoobject.c -arch ppc
-Wl,-F/System/Library/Frameworks -framework Python -u __dummy -u
_PyMac_Error -framework System  -framework CoreServices -framework
Foundation -ldl

See the -I flags in there.

You will see this when you run 'make' to build mod_python. Find the
equivalent invocation of apxs to compile mod_python when you build it
and post that small subset of lines which shows the -I flags.

Graham

> Thanks.
>
>
>
> On Tue, Apr 8, 2008 at 8:28 PM, Graham Dumpleton
> <graham.dumpleton at gmail.com> wrote:
>
> > 2008/4/9 Kyle Simpson <kyle.simpson at gmail.com>:
> >
> > > Any other ideas on this topic?
> >
> > As I said before, the problem is that you are managing to either
> > install mod_python.so into the wrong installation or you have compiled
> > it against the header files for the wrong version of Apache.
> >
> > The proof of this is that the magic number your mod_python.so has equates
> to:
> >
> >  #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
> >
> > whereas Apache is expecting:
> >
> >  #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
> >
> > Do you have header files installed in the following directory?
> >
> >  /usr/local/apache28/include
> >
> > Are those header files readable to the user that you are compiling
> mod_python?
> >
> > Look in the header file 'ap_mmn.h' in that directory, what is the
> > value of MODULE_MAGIC_COOKIE?
> >
> > Now go find where the header files for your other Apache installation
> > are located and find what its value of MODULE_MAGIC_COOKIE is? What
> > directory are those header files in?
> >
> > To work out why it is picking up wrong header files, as I suggested
> > before, look at the -I flags used when compiler is run on mod_python
> > source code. For example on my system I get:
> >
> > /usr/local/apache-2.2.4/bin/apxs
> > -I/Users/grahamd/Projects/mod_python-trunk/src/include
> >
> -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
> > -DNDEBUG -Wc,'-arch ppc' -c mod_python.c _apachemodule.c
> > requestobject.c tableobject.c util.c serverobject.c connobject.c
> > filterobject.c hlist.c hlistobject.c finfoobject.c -arch ppc
> > -Wl,-F/System/Library/Frameworks -framework Python -u __dummy -u
> > _PyMac_Error -framework System  -framework CoreServices -framework
> > Foundation -ldl
> >
> > What do you get?
> >
> > Graham
> >
> >
> >
> >
> > > httpd: Syntax error on line 55 of /usr/local/apache28/conf/httpd.conf:
> API
> > > module structure 'python_module' in file
> > > /usr/local/apache28/modules/mod_python.so is garbled - expected
> signature
> > > 41503232 but saw 41503230 - perhaps this is not an Apache module DSO, or
> was
> > > compiled for a different Apache version?
> > >
> > > running on 2.6.9-023stab044.11-smp
> > >
> > > apache 2.2.8 (second install, which was in /usr/local/apache28
> > >
> > > python 2.5.2
> > >
> > >
> > > Thanks,
> > > Kyle
> > >
> > >
> > >
> > > On Tue, Apr 8, 2008 at 7:19 AM, Kyle Simpson <kyle.simpson at gmail.com>
> wrote:
> > >
> > > > 2 versions of apache
> > > >
> > > > just ./configure --with-apxs=/usr/local/apache28/bin/apxs
> > > >
> > > > I did make install
> > > >
> > > > And no, I don't understand the shared library issue.  Unfortunately
> I'm
> > > pretty much a noob, since any previous apache haven't required any
> modules.
> > > >
> > > > Thanks for all the help.  Let me know if you have any other ideas.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Tue, Apr 8, 2008 at 1:49 AM, Graham Dumpleton
> > > <graham.dumpleton at gmail.com> wrote:
> > > >
> > > > > What about my other questions:
> > > > >
> > > > >
> > > > > How many different versions of Apache do you have installed?
> > > > >
> > > > > What options did you use to 'configure' when building mod_python?
> > > > >
> > > > > Did you use the 'install' target to 'make' or copy it by hand?
> > > > >
> > > > > Do you also understand what I am talking about with the shared
> library
> > > > > issue, not that it in itself should cause this problem.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Graham
> > > > >
> > > > > 2008/4/8 Kyle Simpson <kyle.simpson at gmail.com>:
> > > > > > After doing that, new error:
> > > > > >
> > > > > > httpd: Syntax error on line 55 of
> /usr/local/apache28/conf/httpd.conf:
> > > API
> > > > > > module structure 'python_module' in file /usr/loc?
> > > > > >
> > > > > > line 55 is:
> > > > > > 55 LoadModule python_module modules/mod_python.so
> > > > > >
> > > > > > I did reconfigure/compile to see if that helped, but here's the ls
> -la
> > > > > >
> > > > > > 2857 -rwxr-xr-x    1 root     root      2911798 Apr  8 01:35
> > > mod_python.so
> > > > > >
> > > > > > file
> > > > > >
> > > > > > /usr/local/apache28/modules/mod_python.so: ELF 32-bit LSB shared
> > > object,
> > > > > > Intel 80386, version 1 (SYSV), not stripped
> > > > > >
> > > > > > ldd
> > > > > > libpthread.so.0 => /lib/libpthread.so.0 (0x00111000)
> > > > > >         libdl.so.2 => /lib/libdl.so.2 (0x00826000)
> > > > > >         libutil.so.1 => /lib/libutil.so.1 (0x00162000)
> > > > > >         libm.so.6 => /lib/libm.so.6 (0x00ee8000)
> > > > > >          libc.so.6 => /lib/libc.so.6 (0x00832000)
> > > > > >         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00411000)
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Tue, Apr 8, 2008 at 12:52 AM, Graham Dumpleton
> > > > > > <graham.dumpleton at gmail.com> wrote:
> > > > > >
> > > > > > > Did you do a full stop and start of Apache, not just a
> > > restart/reload?
> > > > > > >
> > > > > > >
> > > > > > > 2008/4/8 Kyle Simpson <kyle.simpson at gmail.com>:
> > > > > > >
> > > > > > > > 2857 -rwxr-xr-x    1 root     root      2911798 Apr  7 23:14
> > > > > > > > /usr/local/apache28/modules/mod_python.so
> > > > > > > >
> > > > > > > > /usr/local/apache28/modules/mod_python.so: ELF 32-bit LSB
> shared
> > > object,
> > > > > > > > Intel 80386, version 1 (SYSV), not stripped
> > > > > > > >
> > > > > > > >  libpthread.so.0 => /lib/libpthread.so.0 (0xb7e54000)
> > > > > > > >         libdl.so.2 => /lib/libdl.so.2 (0xb7e50000)
> > > > > > > >         libutil.so.1 => /lib/libutil.so.1 (0xb7e4d000)
> > > > > > > >         libm.so.6 => /lib/libm.so.6 (0xb7e2c000)
> > > > > > > >          libc.so.6 => /lib/libc.so.6 (0xb7d09000)
> > > > > > > >         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb7fee000)
> > > > > > >
> > > > > > > This all indicates that your Python has not been installed with
> a
> > > > > > > shared library and that Python is being linked statically into
> > > > > > > mod_python.so. This is generally not a good as it bloats your
> Apache
> > > > > > > processes by a couple of MB in size. It can also cause issues,
> > > > > > > especially when upgrading from older to newer mod_python and/or
> > > > > > > different version of Python. Thus why it is important to do a
> full
> > > > > > > stop of Apache when replacing mod_python.so in this case.
> > > > > > >
> > > > > > > For details of Python shared library issues, see:
> > > > > > >
> > > > > > >  http://code.google.com/p/modwsgi/wiki/InstallationIssues
> > > > > > >
> > > > > > > This is from mod_wsgi documentation, but same issues apply.
> > > > > > >
> > > > > > > BTW, one more possibility is if you have multiple versions of
> Apache
> > > > > > > installed when mod_python was compiled it used the wrong header
> > > files.
> > > > > > > How did you install mod_python.so.
> > > > > > >
> > > > > > > How many different versions of Apache do you have installed?
> > > > > > >
> > > > > > > What options did you use to 'configure' when building
> mod_python?
> > > > > > >
> > > > > > > Did you use the 'install' target to 'make' or copy it by hand?
> > > > > > >
> > > > > > > If copied by hand, maybe it was compiled against wrong version
> of
> > > > > > > Apache for which you copied it into. You may want tp pay very
> > > careful
> > > > > > > attention to the -I flags to compiler when mod_python was
> compiled.
> > > > > > >
> > > > > > > Graham
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > On Tue, Apr 8, 2008 at 12:30 AM, Graham Dumpleton
> > > > > > > > <graham.dumpleton at gmail.com> wrote:
> > > > > > > >
> > > > > > > > > What do you get when you run:
> > > > > > > > >
> > > > > > > > >  ls -las /usr/local/apache28/modules/mod_python.so
> > > > > > > > >
> > > > > > > > > and:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >  file /usr/local/apache28/modules/mod_python.so
> > > > > > > > >
> > > > > > > > > and:
> > > > > > > > >
> > > > > > > > >  ldd /usr/local/apache28/modules/mod_python.so
> > > > > > > > >
> > > > > > > > > Graham
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2008/4/8 Kyle Simpson <kyle.simpson at gmail.com>:
> > > > > > > > > > Hi Graham,
> > > > > > > > > >
> > > > > > > > > > Thanks for the quick reply.
> > > > > > > > > >
> > > > > > > > > > I compiled all 3: python,apache,mod python.  Did not use
> > > binaries
> > > > > > for
> > > > > > > > any of
> > > > > > > > > > them.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Tue, Apr 8, 2008 at 12:22 AM, Graham Dumpleton
> > > > > > > > > > <graham.dumpleton at gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > > 2008/4/8 Kyle Simpson <kyle.simpson at gmail.com>:
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > > Not sure what to make of this error.  I have apache
> 2.2.8,
> > > > > > python
> > > > > > > > 2.5.2
> > > > > > > > > > and
> > > > > > > > > > > > mod python 3.3.1.
> > > > > > > > > > > >
> > > > > > > > > > > > Any ideas?
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > httpd: Syntax error on line 54 of
> > > > > > > > /usr/local/apache28/conf/httpd.conf:
> > > > > > > > > > API
> > > > > > > > > > > > module structure 'python_module' in file
> > > > > > > > > > > > /usr/local/apache28/modules/mod_python.so is garbled -
> > > expected
> > > > > > > > > > signature
> > > > > > > > > > > > 41503232 but saw 41503230 - perhaps this is not an
> Apache
> > > module
> > > > > > > > DSO, or
> > > > > > > > > > was
> > > > > > > > > > > > compiled for a different Apache version?
> > > > > > > > > > >
> > > > > > > > > > > Exactly what it means.
> > > > > > > > > > >
> > > > > > > > > > > Did you compile mod_python yourself for that version of
> > > Apache or
> > > > > > did
> > > > > > > > > > > you just install a binary package from somewhere for
> both?
> > > > > > > > > > >
> > > > > > > > > > > I am assuming Apache has a concept of an internal ABI
> > > number. This
> > > > > > is
> > > > > > > > > > > changed whenever the ABI is changed. You may not be able
> to
> > > use a
> > > > > > > > > > > precompiled module from an older version of Apache even
> if
> > > same
> > > > > > > > > > > major/minor version, if this ABI has changed.
> > > > > > > > > > >
> > > > > > > > > > > Graham
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
>


More information about the Mod_python mailing list