Alex Leach | 26 May 2012 12:47
Picon

Re: Cython 0.16 and MacOS 10.6 : unrecognized option '-arch'

EPD v7.2 looks like it was built on a Leopard machine (pre Snow Leopard), so 
the Python Makefile included with EPD has some options that needed to be 
tweaked to get to work, on Lion at least, and probably Snow Leopard too. Not 
sure what version of MacOSX you're using though..

First of all, check what SDKs your Xcode provides in:-
/Developer/SDKs/

Each OS seems to provide it's own SDK and the direct predecessor, so Snow 
Leopard (10.6.sdk) has Leopard's (10.5.sdk), whereas Lion (10.7.sdk) includes 
10.6.sdk, but not 10.5.sdk. EPD was built with the 10.5 SDK, so on Lion I've 
tweaked the build Makefile to point to 10.6.sdk, which still contains some 10.5 
libraries.
The Makefile I mentioned can be found at:-
/Library/Frameworks/EPD64.framework/Versions/Current/lib/python2.7/config/Makefile

Numpy distutils uses this to load compiler flags, so the directories it 
references should at least exist. 
Also, if you don't have the relevant headers which Enthought used to build 
numpy (i.e. Intel's MKL), I'm not sure how easy it'll be to compile numpy 
extensions...

Regarding the error message...
I think that either
  a) You've got -arch set in LDFLAGS, whereas it _perhaps_ should only be in 
CFLAGS; or
  b) As Chris suggests, you're not using the XCode version of gcc.
The gcc in /Developer/usr/bin/ should be sym-linked to the latest Apple 
compiler, so I'd use that (llvm-gcc-4.2 on Lion).

On a side note, Enthought released version 7.3 earlier this week. It's 
probably worth updating to that at some point, as they've updated a lot of 
things, including cython (http://www.enthought.com/EPDChangelog.html)

Cheers,
Alex

On Friday 25 May 2012 09:35:21 Chris Barker wrote:
> On Thu, May 24, 2012 at 10:37 AM, Bvaidya <coolastro <at> gmail.com> wrote:
> > I am having this problem of compilation of a .pyx file.
> > This error is to do with an unrecognized option for the gcc compiler.
> > 
> > I create a .pyx file and then setup.py as directed in the Cython 0.16
> > wiki.
> > Then I run the command -
> > 
> > python setup.py build_ext -i
> > 
> > With this I get the error >
> > 
> > gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -isysroot
> > /Developer/SDKs/MacOSX10.5.sdk -DNDEBUG -g -O3 -arch x86_64 -isysroot
> > /Developer/SDKs/MacOSX10.5.sdk
> > -I/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-pack
> > ages/numpy/core/include
> I take it this is the EPD distribution -- this may be a question for
> the EPD folks -- I wonder if they do anything odd with the compiler?
> (though I wouldn't think so) -- and Cython is certainly a common use
> case for EPD users (though this doesn't look like Cython issue --
> you'd have the same issue compiling any extension with distutils.
> 
> > gcc -bundle -undefined dynamic_lookup -g -arch x86_64 -arch x86_64
> > 
> > gcc: error: x86_64: No such file or directory
> > 
> > I am not sure how to get around with this error. I tried gcc-4.0, gcc-4.6.
> > (default) , still I have this problem.
> 
> Are you sure you're using Apple's compilers? I'm pretty sure the -arch
> flag is an Apple extension to gcc.
> 
> Also -- you are running on a 64 bit machine, yes? And have all the
> SDK's installed? (at least the 10.5 one...)
> 
> Sorry not to be more help,
> 
> -Chris


Gmane