[Pythonmac-SIG] building extension problems on OS X python 2.5.1

Ronald Oussoren ronaldoussoren at mac.com
Fri May 4 19:49:01 CEST 2007


On 4 May, 2007, at 18:11, James Boyle wrote:

> INTEL Mac  OS X 10.4.9  Macpython 2.5.1
>
> I am having trouble building extensions onto my MacPython 2.5.1.
> The error for pynetcdf 0.7 is given below but I have had the same
> error on two other packages.
>
> It appears that the builds attempt to make a universal binary by
> default  and attempt to link to a library that I have built as i386
> only.
> The extent of my ignorance is that I would not even know how to build
> a universal library if I wanted to.
> These libraries HDF5 and netCDF4 have fairly complex build scripts.
>
> I would like to be able to turn off the mechanism that is forcing a
> universal build. The PPC part is a waste of space for me.
>
> Of course, my interpretation of the error might be completely off  
> base.
>
> Appreciate any insight.

The easiest way to fix your problem is by patching setup.py and  
adding the following two arguments to all Extension definitions:
	extra_link_args=['-arch', 'i386'], extra_compile_args=['-arch',  
'i386'],

This will tell distutils that you really want a i386 only extension  
instead of a universal one.

As Christofer mentions as well the best solution in the long run is  
teaching the libraries you're using to build as universal binaries. I  
have no idea how hard that would be.

Ronald

>
> --Jim
>
> [krait:~/Desktop/pynetcdf-0.7] boyle5% python setup.py build
> running build
> running config_fc
> running build_src
> building extension "pynetcdf._netcdf" sources
> building data_files sources
> running build_py
> creating build
> creating build/lib.macosx-10.3-fat-2.5
> creating build/lib.macosx-10.3-fat-2.5/pynetcdf
> copying ./__init__.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
> copying ./NetCDF.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
> copying ./netcdf_demo.py -> build/lib.macosx-10.3-fat-2.5/pynetcdf
> running build_ext
> customize UnixCCompiler
> customize UnixCCompiler using build_ext
> building 'pynetcdf._netcdf' extension
> compiling C sources
> C compiler: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/
> MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
> -mno-fused-madd -fPIC -fno-common -dynamic -DNDEBUG -g -O3 -Wall -
> Wstrict-prototypes
>
> creating build/temp.macosx-10.3-fat-2.5
> compile options: '-I/Users/boyle5/netcdf-3.6.2/include -I/Library/
> Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/
> numpy/core/include -I/Library/Frameworks/Python.framework/Versions/
> 2.5/include/python2.5 -c'
> gcc: ./_netcdf.c
> ./_netcdf.c: In function 'PyNetCDFFile_Close':./_netcdf.c: In
> function 'PyNetCDFFile_Close':
>
> ./_netcdf.c:965: warning: passing argument 2 of 'PyDict_Next' from
> incompatible pointer type./_netcdf.c:965: warning: passing argument 2
> of 'PyDict_Next' from incompatible pointer type
>
> ./_netcdf.c: In function 'PyNetCDFVariableObject_subscript':
> ./_netcdf.c:1822: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1822: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1822: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c: In function 'PyNetCDFVariableObject_subscript':
> ./_netcdf.c:1822: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1822: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1822: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1842: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c: In function 'PyNetCDFVariableObject_ass_subscript':
> ./_netcdf.c:1944: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1944: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1944: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c: In function 'PyNetCDFVariableObject_ass_subscript':
> ./_netcdf.c:1944: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1944: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1944: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 3 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 4 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c:1964: warning: passing argument 5 of 'PySlice_GetIndices'
> from incompatible pointer type
> ./_netcdf.c: At top level:
> ./_netcdf.c:2009: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2011: warning: 'intargfunc' is deprecated
> ./_netcdf.c:2011: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2012: warning: 'intargfunc' is deprecated
> ./_netcdf.c:2012: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2013: warning: 'intintargfunc' is deprecated
> ./_netcdf.c:2013: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2014: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2015: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2019: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c: At top level:
> ./_netcdf.c:2009: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2011: warning: 'intargfunc' is deprecated
> ./_netcdf.c:2011: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2012: warning: 'intargfunc' is deprecated
> ./_netcdf.c:2012: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2013: warning: 'intintargfunc' is deprecated
> ./_netcdf.c:2013: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2014: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2015: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c:2019: warning: initialization from incompatible pointer  
> type
> ./_netcdf.c: In function 'PyNetCDFVariable_WriteArray':
> ./_netcdf.c:1626: warning: 'lastloop' may be used uninitialized in
> this function
> ./_netcdf.c: In function 'PyNetCDFVariable_WriteArray':
> ./_netcdf.c:1626: warning: 'lastloop' may be used uninitialized in
> this function
> gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
> bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/
> _netcdf.o -L/Users/boyle5/netcdf-3.6.2/lib -lnetcdf -o build/
> lib.macosx-10.3-fat-2.5/pynetcdf/_netcdf.so
> /usr/bin/ld: for architecture ppc
> /usr/bin/ld: warning /Users/boyle5/netcdf-3.6.2/lib/libnetcdf.a
> archive's cputype (7, architecture i386) does not match cputype (18)
> for specified -arch flag: ppc (can't load from it)
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20070504/12017874/attachment-0001.bin 


More information about the Pythonmac-SIG mailing list