[mod_python] Trouble loading mod_python Mac Os X

Alex Lurthu alex.lurthu at yahoo.com
Sun Jul 27 10:41:59 EDT 2008


 
Hi All,

I have been trying to add mod_python module to apache2. The first road block that i hit was :

httpd:
Syntax error on line 116 of /private/etc/apache2/httpd.conf: Cannot
load /usr/libexec/apache2/mod_python.so into server:
dlopen(/usr/libexec/apache2/mod_python.so, 10): no suitable image
found.  Did find:\n\t/usr/libexec/apache2/mod_python.so: mach-o, but
wrong architecture

To solve this i add the following lines to the Makefile under src directory :

CPPFLAGS = -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -DNDEBUG -DMACOSX -DENABLE_DTRACE
CFLAGS =  -Wc,'-arch ppc7400' -Wc,'-arch ppc64' -Wc,'-arch i386' -Wc,'-arch x86_64'
LDFLAGS =  -arch ppc7400 -arch ppc64 -arch i386 -arch x86_64 -Wl,-F/System/Library/Frameworks -framework Python -u _PyMac_Error -framework Python
LDLIBS = -ldl

It got complied with the required format or platform support.

sh-3.2# file /usr/libexec/apache2/mod_python.so
/usr/libexec/apache2/mod_python.so: Mach-O universal binary with 4 architectures
/usr/libexec/apache2/mod_python.so (for architecture ppc):    Mach-O bundle ppc
/usr/libexec/apache2/mod_python.so (for architecture ppc64):    Mach-O 64-bit bundle ppc64
/usr/libexec/apache2/mod_python.so (for architecture i386):    Mach-O bundle i386
/usr/libexec/apache2/mod_python.so (for architecture x86_64):    Mach-O 64-bit bundle x86_64

After this step, when i tried LoadModule in the httpd.conf file i got the following error.

httpd: Syntax error on line 117 of /private/etc/apache2/httpd.conf: Can't locate API module structure `python_module' in file /usr/libexec/apache2/mod_python.so: dlsym(0x100216ae0, python_module): symbol not found

Stuck
at this point. Have a working wsgi module, but still wondering why this
is loading. Ensured that it got built against the correct apache
libraries and python libraries. 

The following are the versions that i use :

Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) 
sh-3.2# apachectl -v
Server version: Apache/2.2.8 (Unix)
Server built:   Mar  4 2008 21:37:02

Platform : sh-3.2# uname -a
Darwin sickreturn-lm 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun  9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386

Hardware : Apple Macbook Pro (Intel 32 bit )

Output of otool pasted at the end. Thanks for the help.

--
Alex
http://alexlurthu.wordpress.com

sh-3.2# otool -l /usr/libexec/apache2/mod_python.so
/usr/libexec/apache2/mod_python.so:
Load command 0
      cmd LC_SEGMENT
  cmdsize 328
  segname __TEXT
   vmaddr 0x00000000
   vmsize 0x00016000
  fileoff 0
 filesize 90112
  maxprot 0x00000007
 initprot 0x00000005
   nsects 4
    flags 0x0
Section
  sectname __text
   segname __TEXT
      addr 0x00001358
      size 0x00011f4c
    offset 4952
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x80000400
 reserved1 0
 reserved2 0
Section
  sectname __cstring
   segname __TEXT
      addr 0x000132a4
      size 0x00002caa
    offset 78500
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000002
 reserved1 0
 reserved2 0
Section
  sectname __const
   segname __TEXT
      addr 0x00015f50
      size 0x000000a0
    offset 89936
     align 2^4 (16)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __literal8
   segname __TEXT
      addr 0x00015ff0
      size 0x00000008
    offset 90096
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000004
 reserved1 0
 reserved2 0
Load command 1
      cmd LC_SEGMENT
  cmdsize 328
  segname __DATA
   vmaddr 0x00016000
   vmsize 0x00003000
  fileoff 90112
 filesize 12288
  maxprot 0x00000007
 initprot 0x00000003
   nsects 4
    flags 0x0
Section
  sectname __data
   segname __DATA
      addr 0x00016000
      size 0x0000227c
    offset 90112
     align 2^5 (32)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __dyld
   segname __DATA
      addr 0x0001827c
      size 0x00000008
    offset 98940
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __bss
   segname __DATA
      addr 0x00018284
      size 0x00000024
    offset 0
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000001
 reserved1 0
 reserved2 0
Section
  sectname __common
   segname __DATA
      addr 0x000182a8
      size 0x00000004
    offset 0
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000001
 reserved1 0
 reserved2 0
Load command 2
      cmd LC_SEGMENT
  cmdsize 192
  segname __IMPORT
   vmaddr 0x00019000
   vmsize 0x00001000
  fileoff 102400
 filesize 4096
  maxprot 0x00000007
 initprot 0x00000007
   nsects 2
    flags 0x0
Section
  sectname __pointers
   segname __IMPORT
      addr 0x00019000
      size 0x000000ac
    offset 102400
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000006
 reserved1 0 (index into indirect symbol table)
 reserved2 0
Section
  sectname __jump_table
   segname __IMPORT
      addr 0x000190c0
      size 0x000004dd
    offset 102592
     align 2^6 (64)
    reloff 0
    nreloc 0
     flags 0x04000008
 reserved1 43 (index into indirect symbol table)
 reserved2 5 (size of stubs)
Load command 3
      cmd LC_SEGMENT
  cmdsize 56
  segname __LINKEDIT
   vmaddr 0x0001a000
   vmsize 0x00006000
  fileoff 106496
 filesize 24436
  maxprot 0x00000007
 initprot 0x00000001
   nsects 0
    flags 0x0
Load command 4
     cmd LC_SYMTAB
 cmdsize 24
  symoff 112544
   nsyms 572
  stroff 120624
 strsize 10308
Load command 5
            cmd LC_DYSYMTAB
        cmdsize 80
      ilocalsym 0
      nlocalsym 262
     iextdefsym 262
     nextdefsym 44
      iundefsym 306
      nundefsym 266
         tocoff 0
           ntoc 0
      modtaboff 0
        nmodtab 0
   extrefsymoff 0
    nextrefsyms 0
 indirectsymoff 119456
  nindirectsyms 292
      extreloff 119408
        nextrel 6
      locreloff 106496
        nlocrel 756
Load command 6
          cmd LC_LOAD_DYLIB
      cmdsize 52
         name /usr/lib/libSystem.B.dylib (offset 24)
   time stamp 2 Thu Jan  1 05:30:02 1970
      current version 111.1.1
compatibility version 1.0.0
Load command 7
          cmd LC_LOAD_DYLIB
      cmdsize 88
         name /System/Library/Frameworks/Python.framework/Versions/2.5/Python (offset 24)
   time stamp 2 Thu Jan  1 05:30:02 1970
      current version 2.5.1
compatibility version 2.5.0
Load command 8
          cmd LC_LOAD_DYLIB
      cmdsize 52
         name /usr/lib/libgcc_s.1.dylib (offset 24)
   time stamp 2 Thu Jan  1 05:30:02 1970
      current version 1.0.0
compatibility version 1.0.0


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080727/20eb92f9/attachment.html


More information about the Mod_python mailing list