[Pythonmac-SIG] Re: Compiler flags question for OSX compilation...

Tony McDonald tony.mcdonald@ncl.ac.uk
Tue, 22 May 2001 22:13:15 +0100


On 21/5/01 9:23 am, "Jack Jansen" <jack@oratrix.nl> wrote:

> The MacOSX dynamic loader is extremely picky about symbols, and indeed it
> doesn't want a multiply defined symbol anywhere.
> 

Tell me about it - it's driving me up the wall!

> So, in your first problem (the _XML_DefaultCurrent one) my guess is that you
> have a dynamic module that is already linked statically. The easiest way to
> find the culprit is to use nm to find who's defining it during the normal
> Python build. The build creates a couple of .a libraries and the proceeds to
> link these together, if you run nm | grep _XML_DefaultCurrent on the libraries
> you should find the object file defining it.
> 

After installing a fresh copy of Python (from source) and reinstalling
4Suite-0.11, I get this;

[8:29am tonymcd 4Suite-0.11/test_suite/4XSLT]% python2.1 test_message.py
dyld: python2.1 multiple definitions of symbol _main
python2.1 definition of _main
/usr/local/lib/python2.1/site-packages/Ft/Lib/cDomlettec.so definition of
_main

I then nuked the entire python directory and installed Tonys' MacOS-X
precompiled python2.1 (with pyexpat built in). I rebuilt PyXML-0.6.5 (which
recognises that a pyexpat exists and doesn't try to build one) and
4Suite-0.11. Then;

[9:10am tonymcd 4Suite-0.11/test_suite/4XSLT]% python test_message.py
dyld: python multiple definitions of symbol _XML_DefaultCurrent
python definition of _XML_DefaultCurrent
/usr/local/lib/python2.1/site-packages/Ft/Lib/cDomlettec.so definition of
_XML_DefaultCurrent

Worse still, I can't find any mention of XML_DefaultCurrent in the
4Suite-0.11 source tree.

:(

And looking around a bit..

[9:15am tonymcd python2.1/site-packages/Ft]% nm Lib/cDomlettec.so | grep
_XML_DefaultCurrent
00018ef4 T _XML_DefaultCurrent

with

[9:19am tonymcd /usr/local/bin]% nm python | grep _XML_DefaultCurrent
000725dc T _XML_DefaultCurrent

Now I'm stuck. I *presume* the _XML_DefaultCurrent symbol is from the
pyexpat that Tony compiled in, but I don't know for sure.

There is an environment variable that 4Thought mention (BETA_DOMLETTE) that
is supposed to activate cDomlettec, but it doesn't work in the test_suite
directory.

> The second problem is a bit strange pyexpat.so seems to have a main program.
> It shouldn't, Python already has a main program. But: on most platforms this
> wouldn't be a problem at all, so it may well be that the way pyexpat is built
> always does this. Is this the pyexpat that's included with Python 2.1, or does
> it come from a different place?

It's the pyexpat from PyXML-0.6.5.

I suppose I could be misusing distutils in some way (environment variables
etc) but I don't know for sure.

Thanks for the thoughts Jack, I guess this is something I'm going to have to
keep on (and on) at.

I'd encourage people to have a look at MacOS X - it's very nice indeed!
Tone.
-- 
Dr Tony McDonald,  Assistant Director, FMCC, http://www.fmcc.org.uk/
The Medical School, Newcastle University Tel: +44 191 243 6140
A Zope list for UK HE/FE  http://www.fmcc.org.uk/mailman/listinfo/zope