[SciPy-Dev] OSX build failing at gfortran link

Matthew Brett matthew.brett at gmail.com
Mon Oct 4 16:29:58 EDT 2010


Hi,

I am sorry for my ignorance, but I am running into trouble building
SVN current scipy on OSX:

macpython python 2.6.6
OSX 10.6.4
XCode 3.2.3
numpy 1.5.0 from sourceforge binary
gfortran from ATT - 4.2.3
export CXX=/usr/bin/c++-4.0

Specifically, my build ends like this:

collect2: ld returned 1 exit status
ld: warning: object file compiled with -mlong-branch which is no
longer needed. To remove this warning, recompile without
-mlong-branch: /usr/local/lib/gcc/powerpc-apple-darwin8/4.2.3/crt3.o
ld: warning: in build/temp.macosx-10.3-fat-2.6/libdfftpack.a, file was
built for unsupported file format which is not the architecture being
linked (ppc)
ld: warning: in build/temp.macosx-10.3-fat-2.6/libfftpack.a, file was
built for unsupported file format which is not the architecture being
linked (ppc)
lipo: can't open input file:
/var/folders/jg/jgfZ12ZXHwGSFKD85xLpLk+++TI/-Tmp-//ccLDwo7E.out (No
such file or directory)
error: Command "/usr/local/bin/gfortran-4.0 -Wall -arch ppc -arch i686
-arch x86_64 -arch ppc64 -Wall -undefined dynamic_lookup -bundle
build/temp.macosx-10.3-fat-2.6/build/src.macosx-10.3-fat-2.6/scipy/fftpack/_fftpackmodule.o
build/temp.macosx-10.3-fat-2.6/scipy/fftpack/src/zfft.o
build/temp.macosx-10.3-fat-2.6/scipy/fftpack/src/drfft.o
build/temp.macosx-10.3-fat-2.6/scipy/fftpack/src/zrfft.o
build/temp.macosx-10.3-fat-2.6/scipy/fftpack/src/zfftnd.o
build/temp.macosx-10.3-fat-2.6/build/src.macosx-10.3-fat-2.6/scipy/fftpack/src/dct.o
build/temp.macosx-10.3-fat-2.6/build/src.macosx-10.3-fat-2.6/fortranobject.o
-Lbuild/temp.macosx-10.3-fat-2.6 -ldfftpack -lfftpack -lgfortran -o
build/lib.macosx-10.3-fat-2.6/scipy/fftpack/_fftpack.so" failed with
exit status 1

If I remove the "-arch x86_64 -arch ppc64" from the above line, it compiles OK.

I suppose this is because my macpython 2.6 is a 32 bit binary.

I tried setting:

export FFLAGS='-arch i386 -arch ppc'

but it looks as if ('python setup.py config_fc --help-fcompiler')
numpy distutils ignores the FFLAGS in generating the link flags for
gfortran.

My only option then is the rather unpleasant:

export LDFLAGS="-Wall -arch ppc -arch i386 -undefined dynamic_lookup -bundle"

Thus the combination of:

export FFLAGS='-arch i386 -arch ppc'
export LDFLAGS="-Wall -arch ppc -arch i386 -undefined dynamic_lookup -bundle"

does work, and generates scipy with no test failures.

Looking at numpy/distutils/fcompiler/gnu.py, I see that the function
``_can_target`` cycles through the arch flags seeing whether they (on
their own) raise an error when compiling an empty .f file.    I guess
the problem here is that, although gfortran will compile a file with
'-arch x86_64' - it can't link a python extension with '-arch x86_64'.
 Would it make any sense to get the -arch flags somehow from the
default C linking flags?  Is that sensible?  Is it easy?

Thanks a lot,

Matthew



More information about the SciPy-Dev mailing list