[f2py] Problems with -arch flag on Mac

Raymond P. <[email protected]>
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
Hello,

I have been having problems running f2py on an OS10.5 Mac with Python  
2.6 installed
from the MacPython disk image and with the numpy/f2py installation  
from Sourceforge
as follows:

numpy-1.3.0-py2.6-macosx10.5.dmg
python-2.6.4_macosx10.3.dmg

I have the gfortran compiler also from the Mac install: gfortran- 
macosx-x86.dmg



I understand that others are having the similar problems with -arch  
under OS10.6,
compounded by additional problems related to the 32/64 bit distinction  
in
the compilers.

The problem is that f2py generates a -arch flag for the Fortran  
compiler,
whereas this is not accepted by gfortran (only by gcc).  The output
of the hello test is as follows below.  I tried over-riding the flags  
using
the --fflags command-line option, but that does not get rid of the
-arch flag. I looked everywhere in distutils to see where -arch is being
added in, and couldn't find it.  My understanding is that people were
running f2py fine under 10.5 previously, so maybe the problem has
crept in with Python2.6.  I haven't tried reverting to Python2.5.
I'm completely stymied by this, and so are many colleagues
who rely on f2py, so rescue is much appreciated.

rtp1% f2py -c hello.f
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands -- 
compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands -- 
fcompiler options
running build_src
building extension "untitled" sources
f2py options: []
f2py:> /tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6/untitledmodule.c
creating /tmp/tmpRJJVSy
creating /tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6
Reading fortran codes...
	Reading file 'hello.f' (format:fix,strict)
Post-processing...
	Block: untitled
			Block: hello
Post-processing (stage 2)...
Building modules...
	Building module "untitled"...
		Constructing wrapper function "hello"...
		  hello(x)
	Wrote C/API module "untitled" to file "/tmp/tmpRJJVSy/src.macosx-10.3- 
fat-2.6/untitledmodule.c"
   adding '/tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6/fortranobject.c' to  
sources.
   adding '/tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6' to include_dirs.
copying /Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/ 
tmpRJJVSy/src.macosx-10.3-fat-2.6
copying /Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/ 
tmpRJJVSy/src.macosx-10.3-fat-2.6
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize NAGFCompiler
Could not locate executable f95
customize AbsoftFCompiler
Could not locate executable f90
Could not locate executable f77
customize IBMFCompiler
Could not locate executable xlf90
Could not locate executable xlf
customize IntelFCompiler
Found executable /opt/intel/fce/10.1.017/bin/ifort
customize GnuFCompiler
Could not locate executable g77
customize Gnu95FCompiler
Found executable /sw/bin/gfortran
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin9 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin9 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site- 
packages/numpy/distutils/fcompiler/gnu.py:119: UserWarning: Env.  
variable MACOSX_DEPLOYMENT_TARGET set to 10.3
   warnings.warn(s)
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin9 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin9 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2
customize Gnu95FCompiler
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin9 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin9 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin9 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2
Using built-in specs.
Target: i686-apple-darwin9
Configured with: ../gcc-4.2.2/configure --prefix=/sw --prefix=/sw/lib/ 
gcc4.2 --mandir=/sw/share/man --infodir=/sw/share/info --enable- 
languages=c,c++,fortran,objc,java --with-arch=nocona --with- 
tune=generic --host=i686-apple-darwin9 --with-gmp=/sw --with-libiconv- 
prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x- 
libraries=/usr/X11R6/lib
Thread model: posix
gcc version 4.2.2
customize Gnu95FCompiler using build_ext
building 'untitled' extension
compiling C sources
C compiler: gcc-4.0 -DNDEBUG -g -O3

creating /tmp/tmpRJJVSy/tmp
creating /tmp/tmpRJJVSy/tmp/tmpRJJVSy
creating /tmp/tmpRJJVSy/tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6
compile options: '-I/tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6 -I/Library/ 
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ 
numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/ 
include/python2.6 -c'
gcc-4.0: /tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6/fortranobject.c
gcc-4.0: /tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6/untitledmodule.c
compiling Fortran sources
Fortran f77 compiler: /sw/bin/gfortran -Wall -ffixed-form -fno-second- 
underscore -arch i686 -fPIC -O3 -funroll-loops
Fortran f90 compiler: /sw/bin/gfortran -Wall -fno-second-underscore - 
arch i686 -fPIC -O3 -funroll-loops
Fortran fix compiler: /sw/bin/gfortran -Wall -ffixed-form -fno-second- 
underscore -Wall -fno-second-underscore -arch i686 -fPIC -O3 -funroll- 
loops
compile options: '-I/tmp/tmpRJJVSy/src.macosx-10.3-fat-2.6 -I/Library/ 
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ 
numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/ 
include/python2.6 -c'
gfortran:f77: hello.f
f951: error: unrecognized command line option "-arch"
f951: error: unrecognized command line option "-arch"
error: Command "/sw/bin/gfortran -Wall -ffixed-form -fno-second- 
underscore -arch i686 -fPIC -O3 -funroll-loops -I/tmp/tmpRJJVSy/ 
src.macosx-10.3-fat-2.6 -I/Library/Frameworks/Python.framework/ 
Versions/2.6/lib/python2.6/site-packages/numpy/core/include -I/Library/ 
Frameworks/Python.framework/Versions/2.6/include/python2.6 -c -c  
hello.f -o /tmp/tmpRJJVSy/hello.o" failed with exit status 1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.