Opened 14 years ago

Closed 13 years ago

#1007 closed defect (wontfix)

SWIG Python 1.3.1 gdal interface doesn't compile

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

Description (last modified by hobu)

Hi,

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

Here is the way I did it :

./configure --with-ngpython
make

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/setup.py :     
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 setup.py build

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

LIBRARIES:
	['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',
'../../ogr/ogrsf_frmts/ogr_attrind.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
build/lib.cygwin-1.5.18-i686-2.4/_gdal.dll
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
-lgdal
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 ?

Didrik

Change History (9)

comment:1 Changed 14 years ago by dpinte@…

Got another problem.
swig/python/setup.py : 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"]

Didrik

comment:2 Changed 14 years ago by dpinte@…

Hi,

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/setup.py) :

    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 Changed 13 years ago by hobu

Didrik,

Is this bug now fixed and can it be closed?

Howard

comment:4 Changed 13 years ago by dpinte@…

Howard,

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 ;-)

Didrik

comment:7 Changed 13 years ago by hobu

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

Didrik,

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

Howard

comment:8 Changed 13 years ago by warmerdam

Milestone: 1.4.11.4.2

Moving to 1.4.2 milestone since this is stalled on feedback.

comment:9 Changed 13 years ago by dpinte

Hi Howard,

Sorry for the silence about the problem, I'm actually squeezed by two projects and do not have any time for the tests. I think it will be ok in a week or two. I'll let you know.

Didrik

comment:10 Changed 13 years ago by hobu

Didrik,

Pinging you again if you can test this so we can close.

Howard

comment:11 Changed 13 years ago by hobu

Resolution: wontfix
Status: assignedclosed

Closing for lack of response

Note: See TracTickets for help on using tickets.