Python import error: Symbol not found, but the symbol is present in the file

Posted by Autopulated on Stack Overflow See other posts from Stack Overflow or by Autopulated
Published on 2010-06-07T12:03:15Z Indexed on 2010/06/07 21:52 UTC
Read the original article Hit count: 332

Filed under:
|
|

I get this error when I try to import ssrc.spread:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ssrc/_spread.so, 2): Symbol not found: __ZN17ssrcspread_v1_0_67Mailbox11ZeroTimeoutE

The file in question (_spread.so) includes the symbol:

$ nm _spread.so | grep _ZN17ssrcspread_v1_0_67Mailbox11ZeroTimeoutE
     U __ZN17ssrcspread_v1_0_67Mailbox11ZeroTimeoutE
     U __ZN17ssrcspread_v1_0_67Mailbox11ZeroTimeoutE

(twice because the file is a fat ppc/x86 binary)

The archive header information of _spread.so is:

$ otool -fahv _spread.so
Fat headers
fat_magic FAT_MAGIC
nfat_arch 2
architecture ppc7400
    cputype CPU_TYPE_POWERPC
    cpusubtype CPU_SUBTYPE_POWERPC_7400
    capabilities 0x0
    offset 4096
    size 235272
    align 2^12 (4096)
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    capabilities 0x0
    offset 241664
    size 229360
    align 2^12 (4096)
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ssrc/_spread.so (architecture ppc7400):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
   MH_MAGIC     PPC    ppc7400  0x00      BUNDLE    10       1420   NOUNDEFS DYLDLINK BINDATLOAD TWOLEVEL WEAK_DEFINES BINDS_TO_WEAK
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ssrc/_spread.so (architecture i386):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
   MH_MAGIC    I386        ALL  0x00      BUNDLE    11       1604   NOUNDEFS DYLDLINK BINDATLOAD TWOLEVEL WEAK_DEFINES BINDS_TO_WEAK

And my python is python 2.6.4:

$ which python | xargs otool -fahv
Fat headers
fat_magic FAT_MAGIC
nfat_arch 2
architecture ppc
    cputype CPU_TYPE_POWERPC
    cpusubtype CPU_SUBTYPE_POWERPC_ALL
    capabilities 0x0
    offset 4096
    size 9648
    align 2^12 (4096)
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    capabilities 0x0
    offset 16384
    size 13176
    align 2^12 (4096)
/Library/Frameworks/Python.framework/Versions/2.6/bin/python (architecture ppc):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
   MH_MAGIC     PPC        ALL  0x00     EXECUTE    11       1268   NOUNDEFS DYLDLINK TWOLEVEL
/Library/Frameworks/Python.framework/Versions/2.6/bin/python (architecture i386):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
   MH_MAGIC    I386        ALL  0x00     EXECUTE    11       1044   NOUNDEFS DYLDLINK TWOLEVEL

There seems to be a difference in the ppc architecture in the files, but I'm running on an intel, so I don't see why this should cause a problem.

So why might the symbol not be found?

© Stack Overflow or respective owner

Related posts about python

Related posts about osx