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

Tamas Szekeres szekerest at gmail.com
Sat Jun 7 18:30:21 EDT 2008


Hi,

I`ve just tried http://download.osgeo.org/gdal/gdal-1.5.2.tar.gz on my
debian AMD64 installation following your compile steps (the install
directory was different). After the successful build I had managed to
run `make test` in the /csharp directory without further hackings and
file copies. (the csharp related files .so .dll .config was in the
same directory where the application has been started)

However my mono and SWIG version are different:

szekerest at sirius:~$ swig -version

SWIG Version 1.3.31

Compiled with g++ [x86_64-unknown-linux-gnu]
Please see http://www.swig.org for reporting bugs and further information
szekerest at sirius:~$ mcs --version
Mono C# compiler version 1.2.2.1
szekerest at sirius:~$ cat /proc/version
Linux version 2.6.18-5-amd64 (Debian 2.6.18.dfsg.1-13etch6)
(dannf at debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian
4.1.1-21)) #1 SMP Tue Dec 18 21:39:26 UTC 2007



FYI: The expected compile outputs and the `make test` results can be
inspected at the buildbot:

http://buildbot.osgeo.org:8500/waterfall


Best regards,

Tamas


2008/6/7 fevans <fevans at harris.com>:
>
> 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.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list