[Gdal-dev] c# Bindings in Mono/Linux

fevans fevans at harris.com
Sat Jun 7 10:17:40 EDT 2008


This message captures my unsuccessful attempts to get c# bindings to work
under mono/Linux.
Hopefully it will help someone else.

IMPORTANT: If your like me, you're quickly scanning the web looking for a
solution. This is not a solution. It is a snapshot of what was tried, and
what didn't work.

These attempts were made with the following sources

http://download.osgeo.org/gdal/gdal-1.5.1.tar.gz
http://download.osgeo.org/gdal/gdal-1.5.2.tar.gz

Environment:
Mono Rev:	1.9.1
Linux:      	2.6.9-67.0.15.ELsmp x86_64 x86_64 x86_64 GNU/Linux
Swig:     	1.3.35



Reference Discussion Threads:
In investigating the possibility that this was a 32-bit v.s. 64-bit issue, I
found the following threads.
(Linux 64)
http://lists.osgeo.org/pipermail/gdal-dev/2005-October/006838.html
(Linux 64)
http://lists.osgeo.org/pipermail/mapserver-users/2006-November/020562.html
(Windows 64)	http://article.gmane.org/gmane.comp.gis.gdal.devel/14807

Attachment Descriptions:
gdal1.5.2.configuration.log	Contains the output of the ./configure command.
gdal1.5.2.build.log           	Contains the output of the build.
gdal1.5.2.build.warnings.log	Summary of warnings produced by build.
mono.shlib.cop.gdal_wrap.log     Run 'mono-shlib-cop gdal_csharp.dll'



Build Procedures:
./configure --without-libtool --prefix=/ssa/users/fevans/apps/gdal-1.5.2
make >& gdal1.5.2.build.log &
cd swig
make
cd csharp
make
cd $GDAL_SRC_ROOT
make install
export PATH="/ssa/users/fevans/apps/gdal-1.5.2/bin:$PATH"
export
LD_LIBRARY_PATH="/ssa/users/fevans/apps/gdal-1.5.2/lib:$LD_LIBRARY_PATH"






Required Modifications
There is an error in "swig/csharp/GNUmakefile"
Change line 50 from :	echo "<dllmap dll=\""$*"_wrap\" target=\""$@"\" >" >>
$*_csharp.dll.config
                          To:	echo "<dllmap dll=\""$*"_wrap\"
target=\""$@"\" />" >> $*_csharp.dll.config


Other things Tried
1. Copy bindings to gdal install location. The makefile doesn't do this.
After swig/csharp make test failed, I tried numerous things without success.
 - Copy all exes and libs from swig/csharp to $GDAL_HOME/bin or
$GDAL_HOME/lib
 - In addition copy *.dll, *.dll.config to $GDAL_HOME/bin 

export GDAL_DATA=/ssa/users/fevans/apps/gdal-1.5.2/share/gdal
export
LD_LIBRARY_PATH="/ssa/users/fevans/apps/gdal-1.5.2/lib:$LD_LIBRARY_PATH"
export PATH="/ssa/users/fevans/apps/gdal-1.5.2/bin:$PATH"

cd $GDAL_HOME/bin
mono ./GDALInfo.exe /tmp/anImage.tif
Application error: An exception was thrown by the type initializer for
OSGeo.GDAL.Gdal
mono --verbose   ./GDALInfo.exe /tmp/anImage.tif > GDALInfo.exe.stacktrace



2. Modify Gdalmake.opt.in to use lib64.
   This didn't help.

Rename the libraries-Tried modifying the dll.config "dllmap" entries. For
example, change "libgdalcsharp.so" to "libgdal_wrap.so"
-Tried the renaming the libgdalcsharp.so libraries.
-Tried renaming the libraries as described in the previous steps, but did it
in the GNUMakefile, and rebuilt.

Setting MONO_PATH
Didn't help.


Modify the csharp.opt file
This didn't help me. But I'm wondering if the MONO=YES variable needs to be
set in Linux.
I tried it both ways, without success.

#Uncomment the following line if you want to compile with MONO on windows
#MONO = YES

#Comment the following line out if you want to link against the gdal dll
#CSHARP_STATIC_LINKAGE = YES


http://www.nabble.com/file/p17709337/gdal1.5.2.configuration.log
gdal1.5.2.configuration.log 
http://www.nabble.com/file/p17709337/gdal1.5.2.build.log gdal1.5.2.build.log 
http://www.nabble.com/file/p17709337/gdal1.5.2.build.warnings.log
gdal1.5.2.build.warnings.log 
http://www.nabble.com/file/p17709337/gdal1.5.2.make.install.log
gdal1.5.2.make.install.log 
http://www.nabble.com/file/p17709337/gdal1.5.2.swig.build.log
gdal1.5.2.swig.build.log 
http://www.nabble.com/file/p17709337/gdal1.5.2.swig.build.warnings.log
gdal1.5.2.swig.build.warnings.log 
http://www.nabble.com/file/p17709337/gdal1.5.2.swig.csharp.make.test.log
gdal1.5.2.swig.csharp.make.test.log 
http://www.nabble.com/file/p17709337/GDALInfo.exe.stacktrace
GDALInfo.exe.stacktrace 
http://www.nabble.com/file/p17709337/mono.shlib.cop.gdal_wrap.log
mono.shlib.cop.gdal_wrap.log 

-- 
View this message in context: http://www.nabble.com/c--Bindings-in-Mono-Linux-tp17709337p17709337.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.



More information about the gdal-dev mailing list