Quick howto for compiling and running C# Mapscript (Linux)

Abe Gillespie agillesp at VT.EDU
Tue Jan 4 22:36:59 EST 2005


Right now I only intend to use it with mod_mono / ASP.NET.  Though this
will take some time since I've built an extensive framework around PHP
(I'm pretty proud of this one - http://141.152.79.120/ashe/).  But I
could also see myself making some nice desktop utilities that will be
cross platform.  There are some really exciting possibilities.

-Abe

On Jan 4, 2005, at 8:13 PM, Sean Gillies wrote:

> On Jan 4, 2005, at 5:58 PM, Abe Gillespie wrote:
>
>> Prerequisites:
>> 1.  An installed Mono
>> 2.  A configured MapServer source tree
>>
>> In the source tree you'll find \mapscript\csharp\Makefile; open it.
>> Two directories above that you'll see a file named mapscriptvars; open
>> it.  From the mapscriptvars file you'll need to copy the CCFLAGS and
>> LDFLAGS values to Makefile.  *Note - in mapscriptvars you won't see
>> "CCFLAGS=blah" or "LDFLAGS=blah" but the lines look something like:
>>
>> -DIGNORE_MISSING_DATA -DNEED_STRLCAT -DUSE_EPPL -DUSE_TIFF
>> -DUSE_GD_GIF
>> -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT
>> -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS -DUSE_OGR -DUSE_GDAL
>>
>> and
>>
>> -L. -lmap -L/usr/src/gd-2.0.33/.libs -lgd -L/usr/src/jpeg-6b -ljpeg
>> -lfreetype -L/usr/src/libpng-1.2.5 -lpng -L/usr/src/zlib-1.2.1 -lz
>> -L/usr/src/tiff-v3.6.1/lib64 -ltiff -L/usr/src/jpeg-6b -ljpeg
>> -lfreetype -L/usr/src/libpng-1.2.5 -lpng -L/usr/src/zlib-1.2.1 -lz
>> -L/usr/src/jpeg-6b -ljpeg -L/usr/local/lib -lgdal -lc -lm
>>
>> One thing I didn't have to do was copy over the include directories
>> ...
>> so, if it works for you, ignore the line that looks something like:
>>
>> -I. -I/usr/src/gd-2.0.33 -I/usr/src/tiff-v3.6.1/libtiff
>> -I/usr/src/jpeg-6b -I/usr/local/include
>>
>> Ultimately your Makefile should look something like this:
>>
>> .
>> .
>> .
>> CCFLAGS=-DIGNORE_MISSING_DATA -DNEED_STRLCAT -DUSE_EPPL -DUSE_TIFF
>> -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT
>> -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS -DUSE_OGR -DUSE_GDAL
>>
>> LDFLAGS=-L../.. -lmap -L/usr/src/gd-2.0.33/.libs -lgd
>> -L/usr/src/jpeg-6b -ljpeg -lfreetype -L/usr/src/libpng-1.2.5 -lpng
>> -L/usr/src/zlib-1.2.1 -lz -L/usr/src/tiff-v3.6.1/lib64 -ltiff
>> -L/usr/src/jpeg-6b -ljpeg -lfreetype -L/usr/src/libpng-1.2.5 -lpng
>> -L/usr/src/zlib-1.2.1 -lz -L/usr/src/jpeg-6b -ljpeg -L/usr/local/lib
>> -lgdal -lc -lm
>> .
>> .
>> .
>>
>> Now run make.  If all went well you should have libmapscript.so and
>> mapscript_csharp.dll.  You can run a .Net exe (check the examples
>> directory) if you have these two files in the same directory.  If you
>> want them globally accessible copy mapscript_csharp.dll into the
>> mono/1.0 directory.  On my system it lives at /usr/local/lib/mono/1.0
>> Then you'll want to add a mapping to the mono/config file (make sure
>> you've put libmapscript.so in a useful place before doing so).  On my
>> system it lives at /usr/local/etc/mono  Add a line that looks
>> something
>> like:
>>
>> <dllmap dll="libmapscript" target="/usr/local/lib/libmapscript.so" />
>>
>> Enjoy!
>>
>> Has anyone had success doing this on Windows?
>>
>> -Abe
>>
>>
>
> Abe,
>
> How are you going to use C# mapscript?  As a CGI?  mod_mono?  ASP.NET?
> As the mapscript maintainer I am very interested in how well it works
> or doesn't work in these environments.
>
> One day soon we'll have a place where you can publish this kind of
> howto.  Meanwhile, take good notes.
>
> cheers,
> Sean
>
> --
> Sean Gillies
> sgillies at frii dot com
> http://users.frii.com/sgillies
>



More information about the mapserver-users mailing list