[gdal-dev] Java swig binding wont comile.

Michael Pascoe Michael.Pascoe at nt.gov.au
Mon Oct 18 02:03:48 EDT 2010


Thanks Even,

I installed SWIG 1.3.39 then tried to recompile the swig wrappers. First I had to fix some things I had mangled while trying to debug this problem. Then I found I had to run:

make veryclean

in gdal-1.7.2/swig/java to make it recompile the wrappers. (I was trying "make clean" for a while)

Finally I ran:

make 

And after that the example application gdalinfo would compile and run.

Thank you for your assistance

Michael Pascoe


-----Original Message-----
From: Even Rouault [mailto:even.rouault at mines-paris.org] 
Sent: Friday, 15 October 2010 4:45 PM
To: Michael Pascoe
Cc: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] Java swig binding wont comile.

Michael,

my guess is that you use a too old version of SWIG. You could retry generating
the bindings file with SWIG 1.3.39 that is a version known to work.


Selon Michael Pascoe <Michael.Pascoe at nt.gov.au>:

> Hello,
>
> I am trying to get GDAL building and working for the purpose of converting
> various scanned historic maps to the JPEG2000 format and also to georeference
> these images.
>
> I downloaded gdal-1.7.2 and it built fine on (Red Hat 3.4.5-2). I then
> attempted to build the java swig bindings for GDAL using the directions at
> this page:
>
> http://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix
>
> I got the following errors when I ran make:
>
>
> mkdir -p org/gdal/gdal
> mkdir -p org/gdal/gdalconst
> mkdir -p org/gdal/ogr
> mkdir -p org/gdal/osr
> /bin/sh /users/developers/ilismaps/GDAL/gdal-1.7.2/libtool --mode=compile
> --tag=CXX g++ -fno-strict-aliasing -g -O2  -Wall
> -Wdeclaration-after-statement
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/port
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/gcore
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/alg
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/ogr
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/ogr/ogrsf_frmts
> -I/usr/java/jdk1.5.0_10/include -I/usr/java/jdk1.5.0_10/include/linux -c
> gdal_wrap.cpp
> libtool: compile:  g++ -fno-strict-aliasing -g -O2 -Wall
> -Wdeclaration-after-statement
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/port
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/gcore
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/alg
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/ogr
> -I/users/developers/ilismaps/GDAL/gdal-1.7.2/ogr/ogrsf_frmts
> -I/usr/java/jdk1.5.0_10/include -I/usr/java/jdk1.5.0_10/include/linux -c
> gdal_wrap.cpp  -fPIC -DPIC -o .libs/gdal_wrap.o
> cc1plus: warning: command line option "-Wdeclaration-after-statement" is
> valid for C/ObjC but not for C++
> gdal_wrap.cpp: In function `_jstring*
> Java_org_gdal_gdal_gdalJNI_get_1Driver_1ShortName(JNIEnv*, _jclass*, jlong)':
> gdal_wrap.cpp:4194: error: `GDALDriverShadow_get_ShortName' was not declared
> in this scope
> gdal_wrap.cpp:4194: warning: unused variable 'GDALDriverShadow_get_ShortName'
> gdal_wrap.cpp: In function `_jstring*
> Java_org_gdal_gdal_gdalJNI_get_1Driver_1LongName(JNIEnv*, _jclass*, jlong)':
> gdal_wrap.cpp:4211: error: `GDALDriverShadow_get_LongName' was not declared
> in this scope
> gdal_wrap.cpp:4211: warning: unused variable 'GDALDriverShadow_get_LongName'
> gdal_wrap.cpp: In function `_jstring*
> Java_org_gdal_gdal_gdalJNI_get_1Driver_1HelpTopic(JNIEnv*, _jclass*, jlong)':
> gdal_wrap.cpp:4228: error: `GDALDriverShadow_get_HelpTopic' was not declared
> in this scope
> gdal_wrap.cpp:4228: warning: unused variable 'GDALDriverShadow_get_HelpTopic'
> gdal_wrap.cpp: In function `jlong
> Java_org_gdal_gdal_gdalJNI_Driver_1CreateCopy(JNIEnv*, _jclass*, jlong,
> _jstring*, jlong, jint, _jobject*, _jobject*)':
> gdal_wrap.cpp:4378: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_GCPsToGeoTransform(JNIEnv*, _jclass*,
> _jobjectArray*, _jdoubleArray*, jint)':
> gdal_wrap.cpp:5397: warning: cast to pointer from integer of different size
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_get_1Dataset_1RasterXSize(JNIEnv*, _jclass*,
> jlong)':
> gdal_wrap.cpp:6501: error: `GDALDatasetShadow_get_RasterXSize' was not
> declared in this scope
> gdal_wrap.cpp:6501: warning: unused variable
> 'GDALDatasetShadow_get_RasterXSize'
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_get_1Dataset_1RasterYSize(JNIEnv*, _jclass*,
> jlong)':
> gdal_wrap.cpp:6516: error: `GDALDatasetShadow_get_RasterYSize' was not
> declared in this scope
> gdal_wrap.cpp:6516: warning: unused variable
> 'GDALDatasetShadow_get_RasterYSize'
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_get_1Dataset_1RasterCount(JNIEnv*, _jclass*,
> jlong)':
> gdal_wrap.cpp:6531: error: `GDALDatasetShadow_get_RasterCount' was not
> declared in this scope
> gdal_wrap.cpp:6531: warning: unused variable
> 'GDALDatasetShadow_get_RasterCount'
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_Dataset_1BuildOverviews(JNIEnv*, _jclass*, jlong,
> _jstring*, _jintArray*, _jobject*)':
> gdal_wrap.cpp:6750: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_Dataset_1SetGCPs(JNIEnv*, _jclass*, jlong,
> _jobjectArray*, _jstring*)':
> gdal_wrap.cpp:6891: warning: cast to pointer from integer of different size
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_Band_1GetHistogram_1_1SWIG_10(JNIEnv*, _jclass*,
> jlong, jdouble, jdouble, _jintArray*, jboolean, jboolean, _jobject*)':
> gdal_wrap.cpp:7859: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_Band_1GetDefaultHistogram(JNIEnv*, _jclass*,
> jlong, _jdoubleArray*, _jdoubleArray*, _jobjectArray*, jboolean, _jobject*)':
> gdal_wrap.cpp:8076: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_get_1Band_1XSize(JNIEnv*, _jclass*, jlong)':
> gdal_wrap.cpp:8123: error: `GDALRasterBandShadow_get_XSize' was not declared
> in this scope
> gdal_wrap.cpp:8123: warning: unused variable 'GDALRasterBandShadow_get_XSize'
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_get_1Band_1YSize(JNIEnv*, _jclass*, jlong)':
> gdal_wrap.cpp:8138: error: `GDALRasterBandShadow_get_YSize' was not declared
> in this scope
> gdal_wrap.cpp:8138: warning: unused variable 'GDALRasterBandShadow_get_YSize'
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_get_1Band_1DataType(JNIEnv*, _jclass*, jlong)':
> gdal_wrap.cpp:8153: error: `GDALRasterBandShadow_get_DataType' was not
> declared in this scope
> gdal_wrap.cpp:8153: warning: unused variable
> 'GDALRasterBandShadow_get_DataType'
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_Band_1ComputeStatistics(JNIEnv*, _jclass*, jlong,
> jboolean, _jdoubleArray*, _jdoubleArray*, _jdoubleArray*, _jdoubleArray*,
> _jobject*)':
> gdal_wrap.cpp:8742: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_ComputeMedianCutPCT(JNIEnv*, _jclass*, jlong,
> jlong, jlong, jint, jlong, _jobject*)':
> gdal_wrap.cpp:9765: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_DitherRGB2PCT(JNIEnv*, _jclass*, jlong, jlong,
> jlong, jlong, jlong, _jobject*)':
> gdal_wrap.cpp:9828: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_ReprojectImage(JNIEnv*, _jclass*, jlong, jlong,
> _jstring*, _jstring*, jint, jdouble, jdouble, _jobject*)':
> gdal_wrap.cpp:9912: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_ComputeProximity(JNIEnv*, _jclass*, jlong, jlong,
> _jobject*, _jobject*)':
> gdal_wrap.cpp:9999: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_RasterizeLayer(JNIEnv*, _jclass*, jlong,
> _jintArray*, _jobject*, _jdoubleArray*, _jobject*, _jobject*)':
> gdal_wrap.cpp:10074: warning: cast to pointer from integer of different size
> gdal_wrap.cpp:10129: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_Polygonize(JNIEnv*, _jclass*, jlong, jlong,
> _jobject*, jint, _jobject*, _jobject*)':
> gdal_wrap.cpp:10204: warning: cast to pointer from integer of different size
> gdal_wrap.cpp:10243: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_FillNodata(JNIEnv*, _jclass*, jlong, jlong,
> jdouble, jint, _jobject*, _jobject*)':
> gdal_wrap.cpp:10332: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_SieveFilter(JNIEnv*, _jclass*, jlong, jlong,
> jlong, jint, jint, _jobject*, _jobject*)':
> gdal_wrap.cpp:10418: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_RegenerateOverviews(JNIEnv*, _jclass*, jlong,
> _jobjectArray*, _jstring*, _jobject*)':
> gdal_wrap.cpp:10490: warning: cast to pointer from integer of different size
> gdal_wrap.cpp:10509: error: `sProgressInfo' was not declared in this scope
> gdal_wrap.cpp: In function `jint
> Java_org_gdal_gdal_gdalJNI_RegenerateOverview(JNIEnv*, _jclass*, jlong,
> jlong, _jstring*, _jobject*)':
> gdal_wrap.cpp:10575: error: `sProgressInfo' was not declared in this scope
> make: *** [gdal_wrap.lo] Error 1
>
>
> I have very little experience with c++ (hence why I am trying to use the java
> bindings). What could be causing this build error?
>
> Despite this exception I had a go at building the java files and found that a
> lot of the classes had invalid java syntax eg.:
>
> class class GeometryNative extends WeakReference
>
> Im guessing that this is due to the build of the swig bindings failing.
>
> Any assistance with getting the swig bindings to build is greatly
> appreciated.
>
> Thanks
>
> Michael Pascoe
>



Internal Virus Database is out of date.
Checked by AVG - www.avg.com 
Version: 9.0.862 / Virus Database: 271.1.1/3179 - Release Date: 10/06/10 04:04:00


More information about the gdal-dev mailing list