[Pythonmac-SIG] Tiger hand rolled Python 2.4.1: libxml2 oddities
Bob Ippolito
bob at redivi.com
Thu May 5 20:31:21 CEST 2005
On May 5, 2005, at 2:20 PM, Bob Ippolito wrote:
>
> On May 5, 2005, at 12:55 PM, Gary Poster wrote:
>
>
>> Using Python 2.4.1 compiled on Tiger. This symptom did not occur on
>> Panther.
>>
>> Running my app using one command makes an import of libxml2 succeed:
>> all test pass, including a lot of code that relies on libxml2.
>>
>> Running it with another command makes it fail:
>>
>> *** ImportError: Failure linking new module: /Users/gary/jic/opt/
>> libxml2/lib/python/libxml2mod.so: Symbol not found:
>> _xmlTextReaderByteConsumed
>> Referenced from: /Users/gary/jic/opt/libxml2/lib/python/
>> libxml2mod.so
>> Expected in: flat namespace
>>
>> I've put a pdb before the import to examine the two environments.
>> I've checked sys.path, os.environ, and sys.getdlopenflags()
>> (recommended by a coworker) and gotten results that were either
>> identical or that (in the case of sys.path) I munged until they were
>> identical, and still one import works, the other doesn't.
>>
>
> It sounds like libxml2 (or the Python extension) uses the linker
> option flat_namespace .. that's bad. -flat_namespace has been
> deprecated since 10.2 (maybe earlier) and shouldn't be used for
> anything. I can't help you though, I don't use libxml2 so I don't
> know the specifics of why its build/link procedure is broken.
More specifically, after looking again, "libxml2mod.so" isn't
explicitly linking to libxml2 (and may also be using the deprecated -
flat_namespace).. Somewhere in your "one command" it's importing
something that does explicitly link to libxml2, but your "another
command" does not have that side-effect that band-aids the fact that
"libxml2mod.so" is linked incorrectly. The solution to this specific
problem is to fix whatever builds "libxml2mod.so" so that it links
against libxml2 (-lxml2, or adding it to the distutils library list,
etc.).. but I have a feeling that's not the ONLY thing wrong with it.
It "smells" like one of those horribly broken Python extensions that
uses autoconf instead of distutils.
-bob
More information about the Pythonmac-SIG
mailing list