Mac OSX Snow Leopard compile (x86_64 vs i386 problems)

19 views
Skip to first unread message

Dan O'Donovan

unread,
Nov 26, 2009, 9:47:33 AM11/26/09
to PyMC
Introduction: Hi, I'm Dan and I've just found PyMC and it looks
perfect for testing out some ideas I have. I look forward to getting
started, but first:
I posted this as a bug report but I think it's really more suited to
the mailing list, my apologies.

Hi, I'm having trouble compiling PyMC with Snow Leopard 10.6. More
specifically, a simple

python setup.py build

creates a blend of x86_64 and i386 .so files. Many errors along the
lines of

ld: warning: in build/temp.macosx-10.6-i386-2.6/cephes/i0.o, file is
not of required
architecture

(because build/temp.macosx-10.6-i386-2.6/cephes/i0.o: Mach-O 64-bit
object x86_64 )

So we're trying to build an i386 binary (from macosx-10.6-i386-2.6),
but as the compiler is
64bit and hasn't been told otherwise it's attempting to compile x86_64
shared objects.

Question: Is there a smart way to specify which architecture it is
that we want to build? Adding
extra_compile_args=['-arch i386'] to each add_extension in setup.py
works, and builds an i386
set of shared libraries, but isn't elegant or that helpful (as you
then have to convince python to
run as an i386 binary).

Thanks, Dan

Anand Patil

unread,
Nov 26, 2009, 10:03:42 AM11/26/09
to py...@googlegroups.com
Hi Dan,


I ran into similar problems after upgrading to Snow Leopard. I now have the following in my .Profile:

export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-arch i386 -arch x86_64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"

and it works _except_ if I build as su, in which case these variables aren't exported. So I have to remember to build as me, then install as su if necessary.


I don't know a better way to fix it, sorry. But I doubt this is a PyMC-specific problem, so maybe the answer is out there in another mailing list. Please do post here if you figure it out.


Anand




--

You received this message because you are subscribed to the Google Groups "PyMC" group.
To post to this group, send email to py...@googlegroups.com.
To unsubscribe from this group, send email to pymc+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pymc?hl=en.



Daniel O'Donovan

unread,
Nov 26, 2009, 12:48:46 PM11/26/09
to py...@googlegroups.com
Hi Anand, Thanks for the quick response!

That's fixed it for me, I'm wary of putting that in my .Profile (as I'll forget it's there and break future compile x) so the scipy peeps do it like this:

$ LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64" FFLAGS="-arch i386 -arch x86_64" CFLAGS="-arch i386 -arch x86_64" python setup.py build

which also works but definitely isn't any prettier. I'd actually been trying something similar but with the LDFLAGS etc. after the python setup.py build and that wasn't working :-|

Thanks again, I hope to be able to contribute some thing useful some day!

Dan
Daniel O'Donovan
dan.od...@gmail.com



Reply all
Reply to author
Forward
0 new messages