[Pythonmac-SIG] compiling gdal against macpython

Jack Jansen Jack.Jansen at cwi.nl
Mon Dec 1 04:53:43 EST 2003


On 30 Nov 2003, at 3:49, Byron Amerson wrote:

> Hi there.
>
> I have compiled gdal(geospatial data abstraction lib) on my imac  
> running
> 10.3.1 - without python.  The default build is with python, which would
> be cool to have.
>
> evidently(I think) make is dissatisfied and can not see any dynamic  
> libs.
> here is a sample of the output:
>
> ...stuff above
>
> /bin/sh ../libtool --mode=link  g++ gdal_wrap.lo numpydataset.lo
> gdalnumeric.lo ../libgdal.la  -lm -ldl -L/usr/local/pgsql/lib -lpq
> -L../.libs -o _gdalmodule.la \
>         -rpath
> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-
> packages \
>         -no-undefined \
>         -avoid-version \
>         -module
> g++ -Wl,-bind_at_load  -o .libs/_gdalmodule.so -bundle   
> .libs/gdal_wrap.o
> .libs/numpydataset.o .libs/gdalnumeric.o  -L/usr/local/pgsql/lib
> ../.libs/libgdal.dylib -lm -ldl -lpq
> -L/usr/local/src/gdal/gdal-cvs-031104/.libs
> ld: Undefined symbols:
> _PyArg_Parse
> _PyArg_ParseTuple
> _PyDict_New
> _PyDict_Next

There is something wrong with the way gdal builds the extension. I  
assume it is Makefile-based and not distutils based, because I don't  
think distutils ever used libtool (correct?).

What happens is that it doesn't include a reference to the Python  
framework. This is okay for most flavors of unix: they will just  
remember all external references that weren't satisfied during the link  
phase and try to satisfy these at runtime.

It doesn't work for MacOSX, though. Your best bet is to add "-framework  
Python" to the link command. Try adding it to your PYTHON_LIBS  
definition and see what happens.

--
Jack Jansen        <Jack.Jansen at cwi.nl>        http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  
Goldman




More information about the Pythonmac-SIG mailing list