Archive for June 26th, 2014

Jun 26 2014

SGeoS OpenSim 0.8 on Mono 3.6.1 in CentOS 6.5 for SGeoS (Standard Geospatial Server) – Module 9 of 9

Published by under SL In General

As written yesterday, I’m working my way back through build notes.  This draft shows how I reached a couple of dead ends, backed up and took a small turn.  Here’s the end point where new Open Simulator 0.8, not quite two weeks old, is on a git clone of yesterday’s Mono.
The preceding steps have been written as they were developed–and will be posted subsequently.

Install OpenSim to Demonstrate Mono Apps

Build steps for configuration Module-stage-9

 

This installs the immersive 3D virtual world Open Simulator, developed as a C# application, to demonstrate the use of mono on the SGeoS testbed.  It also provides an update to the latest possible mono version, an ASP.NET module for Apache, and the curious little web server XSP as a more direct way of deploying .NET applications.

1)   Start from completed system Module-stage-8


2)  Verify prerequisites and build libGDI+  These are adapted from a build description page http://stackoverflow.com/questions/13184384/mono-3-0-0-build-on-centos-6

 yum -y  update
 yum -y install libpng-devel libjpeg-devel giflib-devel libtiff-devel libexif-devel libX11-devel \
     fontconfig-devel gettext httpd-devel

Confirm that the system standard pkg-config is used from /usr/bin/pkg-config or if any updates have been made, copy them elsewhere and link to /usr/bin/pkg-config; the make can take 12 minutes to build on a single thread, and using the -j4 thread saves nine minutes on an Atom host.

 which pkg-config
 /usr/local/bin/pkg-config
 cd /opt/installs
 wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.9.tar.bz2
 tar xvf libgdiplus-2.10.9.tar.bz2
 cd libgdiplus-2.10.9
 ./configure --prefix=/usr/local
 export echo=echo
 make -j 4
 make install
 ldconfig

3)  Build mod_mono   This is an Apache connector for .NET requests.   It does not appear to be tuned for use with Apache 2.4, but can get along fine with CentOS 6.5 default Apache 2.2.16

Build instructions adapted from
https://www.bluewhaleseo.com/blog/asp-netc-linux-centos6-apache2-ispconfig3-mono3/
and requires axps which appears from httpd-devel group.

 cd /opt/installs
 wget http://download.mono-project.com/sources/mod_mono/mod_mono-2.10.tar.bz2
 tar xvf mod_mono-2.10.tar.bz2
 cd mod_mono-2.10
 ./configure prefix=/usr/local
 make
 make install
 ldconfig

To use the module, edit the relevant httpd.conf (likely either /etc/httpd/conf/httpd.conf or /usr/local/httpd/conf/httpd.conf)   to add this line to load mod_mono module and associate all the typical Microsoft web serving stuff, like index.aspx, Default.aspx, default.aspx, and associate ASP.NET file extensions with the ASP.NET MIME type.

 Include /etc/httpd/conf/mod_mono.conf

If, instead of all that, one simply want the mod_mono module alone to be loaded, then use this
LoadModule mono_module /usr/lib64/httpd/modules/mod_mono.so

4)  Clone Mono from git   There appeared to be issues with the very recent release tarballs, and for deployment of department apps, Mono could be an important part of the system.  These steps have been blended from several build descriptions
http://stackoverflow.com/questions/13184384/mono-3-0-0-build-on-centos-6
https://www.bluewhaleseo.com/blog/asp-netc-linux-centos6-apache2-ispconfig3-mono3/
http://stackoverflow.com/questions/22844569/build-error-mono-3-4-0-centos
http://stackoverflow.com/questions/11410020/compile-install-mono-on-centos-cant-get-past-make
while it’s compiling, mono looks like a mess of warnings for 20 minutes.

Cloning a git repository is at the edge; if it does not work one day, try pulling again in a day or two when the developers have patched it up.

While building works in the end, it does evoke a certain Microsoft-like cloud of doubt while watching mono build.  When it runs well, mono can be a very cool capability in the eyes of those invested in .NET apps and a lever for mitigating anti-Linux attitude among Windows developers.

 cd /opt/installs
 git clone  https://github.com/mono/mono.git
 cd mono
 ./autogen.sh --prefix=/usr/local

mono_autogen0

 

The next step is the  intriguing “Use mono to make mono” step.  Monolite is the spartan build that only has enough to run the old gmcs.exe compiler, from which the real mono can be bootstrapped.

 make get-monolite-latest
 make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/gmcs.exe -j 4
 make check -j 4

Mono should pass all checks

 make install
 mono -V

mono_version_20140626

 

For future updates of Mono, pull from git if desired

 cd /opt/installs/mono
 git pull
 ./autogen.sh --prefix-/usr/local
 make
 make install

5)  Install Mono devleopment packages  these appear to be required by nant to build OpenSim.
These notes were made with reference to
http://stackoverflow.com/questions/16900575/install-mono-and-monodevelop-on-centos-5-x-6-x
It’s important that these Windows things know their way around so set the environmental variable such that PKG_CONFIG_PATH gets to the directory that’s got your latest mono.pc in it

 yum install gtk2-devel libglade2-devel
 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:\
 /usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig

Go for gtk-sharp, a dependency of mono-develop

 cd /opt/installs
 wget http://download.mono-project.com/sources/gtk-sharp212/gtk-sharp-2.12.8.tar.bz2
 tar xvf gtk-sharp-2.12.8.tar.bz2
 cd gtk-sharp-2.12.8
 ./configure --prefix=/usr/local

Patch three sources in glib/glue/*.c  that try to include below <glib.h/> to only include <glib.h>
This was necessary on 2014.06.25 and may not remain so.
patch_1o2

change them to look like the following, then make; expect to see warnings and some sorts of errors.

patch_2o2

 make
 make install

Now go for gnome-sharp, another dependency of mono-develop

 yum install pango-devel atk-devel libgnome-devel libgnomecanvas-devel libgnomeui-devel
 cd /opt/installs
 git clone git://github.com/mono/gnome-sharp
 cd gnome-sharp
 ./bootstrap-2.24 --prefix=/usr/local
 make
 make install

Now go for mono-addins, yet another dependency of mono-develop

cd /opt/installs
 git clone git://github.com/mono/mono-addins
 cd mono-addins
 ./autogen.sh --prefix=/usr/local
 make
 make install

Finally go for mono-develop itself

cd /opt/installs
 wget http://download.mono-project.com/sources/monodevelop/monodevelop-3.1.1.tar.bz2
 tar xvf monodevelop-3.1.1.tar.bz2
 cd monodevelop-3.1.1
 ./configure --prefix=/usr/local
 make -j 4
 <!-- fail 2014.06.25>
cd /opt/installs
 git clone git://github.com/mono/monodevelop
 cd monodevelop
 ./configure --prefix=/usr/local --select

<< maybe just choose main >>

make
 <!-- fail 2014.06.25>

Don’t be too disheartened if the full monodevelop binary doesn’t build, as having the dependencies is a big part of the purpose here.

6)  Install Nant from binary  a popular MS adaptation of Apache Ant build tool.  Used for building Open Simulator or other complex .NET assemblies from source, if one wants to try that later.

cd /opt/installs
 wget http://sourceforge.net/projects/nant/files/nant/0.92/nant-0.92-bin.tar.gz
 tar xvf nant-0.92-bin.tar.gz

that extracts a working binary version of NAnt.exe, so make a script to invoke it

touch /usr/local/bin/nant

then edit that file to include the invocation against mono

mono /opt/installs/nant-0.92/bin/NAnt.exe

finally set the launch script to be executable and perhaps owned by installer group.
The test is ironic, yet informative.

chmod 754 /usr/local/bin/nant
 chown root:installer /usr/local/bin/nant
 nant

NAnt_version_20140626

 

7)  Install MySQL from repository  Just the basics; MySQL might even already be installed.  This is a preferred means of asset storage for Open Simulator, although not configured there by default.

yum install mysql

 

8)  Install Open Simulator binary  A build from source might be attempted, as CentOS doesn’t seem to have been the most popular choice among Opensim adherents.  Requires Mono >= 2.4.3 and NAnt >= 0.85 which both should be satisfied at this point.  A better choice: the compiled binary will very likely just run with Mono (!)

For a source build attempt, satisfy nant with a symlink at a deprecated location.

ln -s /usr/local/lib/mono/4.5/mcs.exe /usr/local/lib/mono/2.0/gmcs.exe

Then just get the OpenSim 0.8 binary; you’ve already got a very current Mono available

cd /opt/installs
 wget http://opensimulator.org/dist/opensim-0.8.tar.gz
 tar xvf opensim-0.8.tar.gz
 cd opensim-0.8
 cd bin

Back up default OpenSim.ini  to  OpenSim_orig.ini — and other files as appropriate from bin/config-include plus configurations described at http://opensimulator.org/wiki/Build_Instructions
To launch a configured OpenSim, it’s like this:

mono OpenSim.exe

Edit  /etc/sysconfig/iptables to have a line like this to allow OpenSim access on :9000

-A INPUT -m state --state NEW -m tcp -p tcp --dport 9000 -j ACCEPT

Then restart iptables

service iptables restart

Testing was conducted with the Singularity viewer for 64-bit Windows, with connections to the simulator running on SGeoS  http://www.singularityviewer.org/

SGeoS_OpenSim_first_light_20140626

In-world saved image of initial simulator region, demonstrating terrain edits, vegetation, object construction, and time-of-day adjustments.  Viewer and interactive editing from Windows 7 workstation, using Singularity Viewer (64-bit) 1.8.5 (5617) to  Open Simulator 0.8 server as compiled C# project running on SGeoS under Mono 3.6.1.

 

That’s it for this module’s draft.  The server, it’s working.  If one were to only care about getting OpenSim 0.8 running on Mono 3.6.1, then perhaps this is everything.  For the SGeoS, these build notes are only the ninth of nine modules.

No responses yet