Opened 18 years ago

Last modified 16 years ago

#1007 closed defect

SWIG Python 1.3.1 gdal interface doesn't compile — at Version 7

Reported by: dpinte@… Owned by: hobu
Priority: high Milestone: 1.4.2
Component: default Version: unspecified
Severity: normal Keywords:

Description (last modified by hobu)


I'm trying to build Python interface on WindowsXP using Cygwin.

Here is the way I did it :

./configure --with-ngpython

The first error was when trying to import gdalwarper.h because includes did not
contain the alg directory. Here is the fix (just added alg dir in the include_dirs:

line 93 of swig/python/ :     
include_dirs=[path.join(TOP_DIR,"alg"), path.join(TOP_DIR,"gcore"),
path.join(TOP_DIR,"port"), path.join(TOP_DIR,"ogr"), path.join(TOP_DIR,"pymod"),
] # only necessary

The next error is the following :

make[2]: Entering directory `/cygdrive/c/Downloads/gdal-1.3.1/swig/python'
python build

	['../../', './', '/usr/local/lib']

	['gdal', 'z', 'stdc++']

INCLUDE_FILES: ['../../gcore/gdal.h', '../../gcore/gdaljp2metadata.h',
'../../gcore/gdal_frmts.h', '../../gcore/gdal_pam.h', '../../gcore/gdal_priv.h',
'../../gcore/gdal_rat.h', '../../gcore/gdal_version.h',
'../../port/cpl_config.h', '../../port/cpl_conv.h', '../../port/cpl_csv.h',
'../../port/cpl_error.h', '../../port/cpl_list.h', '../../port/cpl_minixml.h',
'../../port/cpl_multiproc.h', '../../port/cpl_odbc.h', '../../port/cpl_port.h',
'../../port/cpl_string.h', '../../port/cpl_vsi.h',
'../../port/cpl_vsi_private.h', '../../alg/gdalwarper.h',
'../../alg/gdal_alg.h', '../../alg/gvgcpfit.h', '../../alg/thinplatespline.h',
'../../ogr/ogr_api.h', '../../ogr/ogr_core.h', '../../ogr/ogr_feature.h',
'../../ogr/ogr_featurestyle.h', '../../ogr/ogr_geometry.h',
'../../ogr/ogr_geos.h', '../../ogr/ogr_p.h', '../../ogr/ogr_spatialref.h',
'../../ogr/ogr_srs_api.h', '../../ogr/oledbgis.h', '../../ogr/oledb_sup.h',
'../../ogr/sfcdatasource.h', '../../ogr/sfcenumerator.h', '../../ogr/sfclsid.h',
'../../ogr/sfcschemarowsets.h', '../../ogr/sfctable.h', '../../ogr/sfiiddef.h',
'../../ogr/swq.h', '../../ogr/ogrsf_frmts/ogrsf_frmts.h',
running build
running build_py
running build_ext
building '_gdal' extension
c++ -shared -Wl,--enable-auto-image-base
build/temp.cygwin-1.5.18-i686-2.4/gdal_wrap.o -L../../ -L./ -L/usr/local/lib
-L/usr/lib/python2.4/config -lgdal -lz -lstdc++ -lpython2.4 -o
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
collect2: ld returned 1 exit status
error: command 'c++' failed with exit status 1
make[2]: Leaving directory `/cygdrive/c/Downloads/gdal-1.3.1/swig/python'
make[1]: Leaving directory `/cygdrive/c/Downloads/gdal-1.3.1/swig'
++' failed with exit status 1
make[2]: *** [build] Error 1
make[1]: *** [build] Error 2
make: *** [swig-target] Error 

I'm not a linker expert ... how can i solve that ? -lgdal seems to indicate gdal
library but it is currently build no ?


Change History (5)

comment:1 by dpinte@…, 18 years ago

Got another problem.
swig/python/ : line 45
    gdal_libs = ["LIBS","PG_LIB","MYSQL_LIB"]
caused an KeyError on my computer because I had no PG_LIB, nor MYSQL_LIB.
I've workarounded the problem changing the line with :
    gdal_libs = ["LIBS","PG_LIB","MYSQL_LIB"]


comment:2 by dpinte@…, 18 years ago


I've solved the problem. gdal library is build under the .libs directory of the
gdal sources. The -lgdal did not work during compilation because it does not
found the compiled lib. Changing the path of libraries used for compilation
solve the problem (line 73 of swig/python/ :

    library_dirs = [TOP_DIR+"/",TOP_DIR+"/.libs/"]

With this correction and the line 45 correction (removing PG_LIB and MYSQL_LIB),
I can compile and build the GDAL library on a XP system with Cygwin.

comment:3 by hobu, 17 years ago


Is this bug now fixed and can it be closed?


comment:4 by dpinte@…, 17 years ago


Good question. I have to admit I did not test it on the 1.3.2 version. I will try to test it before the New Year ;-)


comment:7 by hobu, 17 years ago

Description: modified (diff)
Milestone: 1.4.1
Owner: changed from warmerdam to hobu
Status: newassigned


Do you happen to know if these issues have been resolved? We have been doing a number of updates lately for the 1.4.1 release, we might as well clean this one up if it still exists.


Note: See TracTickets for help on using tickets.