[SciPy-Dev] OSX build failing at gfortran link

Ralf Gommers ralf.gommers@googlemail....
Thu Oct 7 04:45:30 CDT 2010


On Tue, Oct 5, 2010 at 4:29 AM, Matthew Brett <matthew.brett@gmail.com>wrote:

> 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.


Correct, see #1399.

>
> 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"
>

Your other option is to remove "ppc64" from line 257 of
numpy/distutils/fcompiler/gnu.py.

>
> 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?
>

I think it makes sense but I'm not sure it's easy. I'll try to figure that
out before 1.5.1rc1, if it's not easy then the patch from #1399 should just
be reverted. Mea culpa again for causing this problem.

Ralf



>
> Thanks a lot,
>
> Matthew
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20101007/62b63916/attachment.html 


More information about the SciPy-Dev mailing list