[Pythonmac-SIG] numpy in python 2.4 vs 2.5

Robert Kern robert.kern at gmail.com
Sat Feb 10 06:18:29 CET 2007


William Kyngesburye wrote:
> I'm trying to build a python extension that uses numpy.  When I build  
> with python 2.4.[whatever the last one was] and the current numpy  
> 1.0.1 package, it succeeds with no problem.
> 
> When I try python 2.5 and the matching numpy 1.0.1:
> 
> building '_gdal' extension
> creating build/temp.macosx-10.3-fat-2.5
> gcc -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 -g -O3 -I../../port -I../../gcore - 
> I../../alg -I../../ogr -I../../macosx/GDAL/gdal -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 gdal_wrap.cpp -o build/temp.macosx-10.3-fat-2.5/gdal_wrap.o
> gdal_wrap.cpp: In function 'int SWIG_Python_ConvertFunctionPtr 
> (PyObject*, void**, swig_type_info*)':
> gdal_wrap.cpp:2051: error: invalid conversion from 'const char*' to  
> 'char*'gdal_wrap.cpp: In function 'int SWIG_Python_ConvertFunctionPtr 
> (PyObject*, void**, swig_type_info*)':
> gdal_wrap.cpp:2051: error: invalid conversion from 'const char*' to  
> 'char*'
> 
> 
> any ideas?

This has nothing to do with numpy. The wrapper source was generated from a
slightly-old version of SWIG that generates non-const-correct C++ code. Python
2.5 uses a version of gcc that's a bit pickier than the 2.4 build that you used.

Get the latest version of SWIG (1.3.31 should be fine, I think), regenerate the
gdal_wrap.cpp, and recompile.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the Pythonmac-SIG mailing list