[Numpy-discussion] distutils seems to pick the wrong fortran compiler flags

Hugo Gagnon opensource.numpy at user.fastmail.fm
Mon Aug 5 13:09:04 EDT 2013


Hi,

I'm using f2py shipping with EPD 32 bit on 64 bit Mac OS 10.8.  The
command "f2py -c -m plot3d --fcompiler=gnu95 plot3d.f90" compiles the
objects files in 32 bit, which is good, but fails at the linkage step
with a "file was built for i386 which is not the architecture being
linked (x86_64)" warning.  See this post for a full output:
http://stackoverflow.com/questions/18003399/wrapping-32-bit-libraries-with-f2py-gfortran-on-mac-os-10-8

My solution was to hack numpy/distutils/fcompiler/gnu.py by explicitly
adding the "-m32" flag to the "compiler_f77", "compiler_f90" and
"linker_so" keys of the "executables" dictionary of the "Gnu95FCompiler"
class (line 251).  I'm sure there's a nicer way to do that though...

-- 
  Hugo Gagnon



More information about the NumPy-Discussion mailing list