Paul Kinnane wrote: > OK, I found I could compile and successfully import the test.c sample > from http://www.nevada.edu/~cwebster/Python/MPWHOWTO/MPWHOWTO.html using > the Darwin "python setup.py install" command. > > However, I'm trying to compile a wrapper for the ode physics engine. > The wrapper is call PyODE (http://pyode.sourceforge.net/) and I've > successfully compiled it on the Windows platform and been able to import > it into python. > > Using "python setup.py install", I get a permissions error. I assume > there is a simply way for me to get the right access rights in Darwin to > do an install?
sudo python setup.py install. "sudo" is Super User Do. It will prompt you for a password, ans if you are an administrative user, you will get full administrative privileges for the command that follows. this is the standard OS-X way to do anything administrative from the command line. By the way, I always do the build and install steps separately: python setup.py build sudo python setup.py install It's best to do as little as possible as the super user. >Anyway, doing a build and then manual install gives the What's a "manual install", and how did you build? What exactly did you do? Which gcc are you using? > following error when trying to import into Python... > > ImportError:Failure linking new module: ode.so: Symbol not found: > ___cxa_pure_virtual > Reference from:ode.so > Expected in:Flat namespace > Researching the web there was a > lot of info about using g++ instead of gcc for linking etc, which coming > from the Win platform was a little confusing. I'm pretty sure that a properly written setup.py and distutils should take care of that for you, but I haven't written any setup.py scripts for C++ myself, so I don't know how. A couple years ago, however, I did have this kind of problem with a C++ file. In that case, it didn't actually use an C++ features, so I changed the syntax a little to make it C, and solved it that way, which isn't going to help you any. In that case the same file worked just fine on Linux, but he way, so OS-X is pickier for some reason. Here is the solution I was offered, that I never tried: """ This just came by on another mailing list. The problem is that the link step is done with "gcc", not "g++", so you have to add the C++ library by hand. The easiest is to add an extra_link_libraries (iirc) flag to the setup.py file. """ > 1) Is there any difference between compiling the extern library wrapper > in gcc verses XCode? No. Xcode is a front-end to gcc. However, it might be hard to make sure all the same flags are used. > 2) If I can use gcc, should I only use gcc3.2? (as recommended in some > msg threads) I'm still running OS-X 10.3, which uses gcc3.3, so I'm not sure. However, while it may not be strictly necessary, it's probably safer to use the same gcc as python was compiled with. When you start up python, the startup message should tell you. > 3) Is defining ___cxa_pure_virtual in the link statement the correct way > to resolve that problem? I doubt it. It is in libstdc++. I've seen a message on the matplotlib that it isn't in all versions, however. I do find it in the version on my machine (6.0.3). Perhaps if you use the same gcc as python was compiled with, you'll be OK. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig