[Pythonmac-SIG] Python on OS X: Multiple definitions of symbols

Tony McDonald tony.mcdonald@ncl.ac.uk
Sun, 15 Apr 2001 12:08:11 +0100


On 10/4/01 4:09 am, "Tim Lahey" <tjlahey@sympatico.ca> wrote:

> All,
> 
> I built the latest beta of Python (2.1b2a) using:
> ./configure --with-dyld --with-suffix=.x
> make
> sudo make install
> 
> Next, I download pyobjc.so from sourceforge. That imports fine. I then
> download and
> compile PyXML and when I try and run the tests:
> 
> [localhost:python/PyXML-0.6.5/test] tjlahey% python test_howto.py
> SAX tests:
> 
> dyld: python multiple definitions of symbol _main
> python definition of _main
> /usr/local/lib/python2.1/site-packages/_xmlplus/parsers/pyexpat.so
> definition of _main
> 
> Does anyone know how to fix these multiple definition of symbol
> problems? I've had this
> kind of problem with Numeric on OS X and I can't seem to figure out how
> to fix this.
> 
> Thanks,
> 
> Tim Lahey

This is very similar to the problem I had with MySQLdb, here's the gist of
my problem,

[localhost:~/software/MySQL-python-0.3.5] tonymcd% python
Python 2.0 (#3, 10/22/00, 12:04:10)
[GCC Apple DevKit-based CPP 5.0] on Darwin1.2
Type "copyright", "credits" or "license" for more information.
>>> import MySQLdb
dyld: python multiple definitions of symbol _strtol
/System/Library/Frameworks/System.framework/Versions/B/System(strtol.o)
definition of _strtol
/usr/local/lib/python2.0/site-packages/_mysql.so definition of _strtol

Note that my Python is a binary release by Steve Majewski (who's on this
list :), ie 
[localhost:/usr/local] tonymcd% more MacOSX-Darwin-Python2.0-README

Python2.0 final built for MacOSX or Darwin1.2
with dyld shared library support
including optional modules: bsddb, readline, zlib, pyexpat,
and under X11: tkinter and pygtk

Files are intended to go in /usr/local/bin and /usr/local/lib/python2.0.

assuming you have write permission, cd to /usr/local and untar


-- Steve Majewski <sdm7g@Virginia.EDU>


In the end I managed to get MySQLdb to work by removing the _strtol library
from mysqlclient.a. This is what I posted to the python news group.

> There was an interesting thread on this at
> http://forums.macnn.com/cgi-bin/Forum34/HTML/000284.html
> (the answer is from bobDalgeish) ,and following the information I
> managed to get it to work in the end.
>
> Essentially get rid of the strto.o entry (which has strtol in it) in
> libmysqlclient.a and ranlib it, ie
>
> % sudo ar -dv libmysqlclient.a strto.o
> % sudo ranlib libmysqlclient.a
>
> Then recompile up MySQLdb and reinstall it (make sure you remove the old
> stuff first).

I'm having exactly the same problem with pyexpat on OS X (from the PyXML
distribution), and haven't managed to get this to work. I know theres a
pyexpat in Steves distribution).

I must admit to being a bit out of my depth here...I'm definitely getting
confused with the OS X Darwin-Python, Carbonised MacPython and the OS 9
Python implementations. Until recently, it was simple, I did some things
like testing XML code on my Python 2.0 OS 9 implementation as the IDE helped
a lot and things like MySQL on my Python 1.5.2 Solaris implementation,
because there were no libraries available - now things are much more
interesting! - but there's a new learning curve :)

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