[Pythonmac-SIG] Problems with universal Python 2.4.3's distutils

Ronald Oussoren ronaldoussoren at mac.com
Tue Oct 24 22:01:55 CEST 2006


 
On Tuesday, October 24, 2006, at 06:09PM, Anand Patil <anand at soe.ucsc.edu> wrote:

>Hi all,
>
>I'm running Universal Python 2.4.3 on my Powerbook G4 under OS X 10.4.8. 
>I'm trying to install a package called mpi4py (MPI for Python), and 
>Universal Python's distutils seem to be causing some trouble. It looks 
>like the -arch i386 argument is confusing the linker somehow because my 
>computer is a PPC. Also, I'm not sure what the library rt is, but there 
>doesn't seem to be such a thing on my computer (though I've installed 
>the latest version of Xcode). Does anyone know how I can resolve this? 
>Sorry if this is OT, I didn't know where else to post.
>
>Thanks for any advice,
>Anand Patil
>
>Anand-Patils-Computer:~/Desktop/mpi4py-0.4.0rc1 anand$ python setup.py 
>build --mpi=mpich2
>running build
>running build_py
>running build_ext
>MPI configuration: from section 'mpich2' in file/s 'mpi.cfg'
>MPI C compiler:    /usr/local/mpich2/bin/mpicc
>MPI C++ compiler:  /usr/local/mpich2/bin/mpicxx
>building 'mpi4py.libmpi' extension
>/usr/local/mpich2/bin/mpicc -arch ppc -arch i386 -isysroot 
>/Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double 
>-no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -O3 
>-I/usr/local/mpich2/include 
>-I/Library/Frameworks/Python.framework/Versions/2.4/include/python2.4 -c 
>mpi/ext/libmpi.c -o build/temp.macosx-10.4-fat-2.4/mpi/ext/libmpi.o
>/usr/local/mpich2/bin/mpicc -arch ppc -arch i386 -isysroot 
>/Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup 
>build/temp.macosx-10.4-fat-2.4/mpi/ext/libmpi.o -L/usr/local/mpich2/lib 
>-L/usr/local/mpich2 -lmpich -lrt -o 
>build/lib.macosx-10.4-fat-2.4/mpi4py/libmpi.so
>/usr/bin/ld: for architecture i386
>/usr/bin/ld: warning /usr/local/mpich2/lib/libmpich.dylib cputype (18, 
>architecture ppc) does not match cputype (7) for specified -arch flag: 
>i386 (file not loaded)
>/usr/bin/ld: can't locate file for: -lrt
>collect2: ld returned 1 exit status
>/usr/bin/ld: for architecture ppc
>/usr/bin/ld: can't locate file for: -lrt
>collect2: ld returned 1 exit status
>lipo: can't open input file: /var/tmp//ccFhLQNI.out (No such file or 
>directory)
>error: command '/usr/local/mpich2/bin/mpicc' failed with exit status 1

The universal build of python builds universal extensions by default. In 2.4.4 you can add ['-arch', 'ppc'] to the extra_compile_args and extra_link_args arguments for Extension (in your setup.py) to build a thin extension. Using CFLAGS and LDFLAGS might work as well, I haven't tested this. IIRC this doesn't work with 2.4.3, the necessary changes were added in 2.5 and 2.4.4.

BTW. The best way (TM) to fix your problem is to build mpich2 as a universal binary :-).

Ronald



More information about the Pythonmac-SIG mailing list