Installing Mono on the Octavo or BeagleBone kb-3

Octavo / Beaglebone Black  

This article will show you how to install Mono, so that you can run the full .net stack using the Mono runtime.  This article is presented for the convenience of users of the Octavo boards by GHI because the canonical installation instructions for Mono on Linux found at : http://www.mono-project.com/docs/getting-started/install/linux/ do not work well on the current (8.5) image for Octavo/BBB.

Preparation:

It is recommended that you be booted from an external SD card of 8Gb or larger.  Mono can require 40Mb and while it might fit on the internal eMMC storage, there will be little or no room for anything else.  For fast booting, you may be able to boot from eMMC and run Mono from the SD card, or install a carefully-crafted set of smaller runtime-only packages, but that more-advanced installation is not covered here.

Also, ensure that you have a working network connection from the device to the outside world.

Steps:

  1. Make sure the apt-get service is up to date:

    sudo apt-get update
     
  2. Install these packages (answer Y when prompted):  Some will already be installed.

    sudo apt-get install build-essential automake checkinstall intltool libtool git
     
  3. Now we install the rest of the mono system.

    sudo apt-get install mono-complete
     
  4. Note that to experiment with only installing the runtime, install mono-runtime instead and then add assembly packages (like libmono-system-xml4.0-cil) one by one as needed.  If you need to compile, you can install mono-devel.
     
  5. You can now test the installation as follows (these commands just ensure that the programs are installed by asking them to display their version information):

    mono --version
    mcs --version

     
  6. You can also test using a simple "hello world" program:
    1. Save the following program into a file called hello.cs

      using System;
      namespace HelloApp {
        class Hello {
          public static void Main(string[] args) {
            Console.WriteLine("Hello World!");
          }
        }
      }

       
    2. Compile and run the program with these two commands:

      mcs hello.cs
      mono hello.exe

      ‚Äč
  7. Mono is now ready to use. Note that you can install a smaller selection of packages if all you want to do is run mono-compiled programs and you can eliminate assembly packages that you don't need.  The instructions above install the full mono system.  This can involve some trial and error and I recommend that you start by determining all of the assemblies that you code relies upon, and then adding the necessary libmono-(assembly)(version) package.
  8. If you have trouble compiling Portable Class Library programs, and receive a "Framework not installed" error, then do "sudo apt-get install referenceassemblies-pcl"
  9. If you have trouble making SSL connections from .Net, then do "sudo apt-get install ca-certificates-mono"

Notes:

You can either edit and develop directly on an Octavo/BBB system, or you can install Mono on a Windows or Linux system and copy over just the .exe files.  If you are just copying .exe files, you can probably trim down the install size substantially as mentioned above.  Of course, for code that uses PInvoke to make calls to libraries for the purpose of controlling Octavo-specific hardware, that code needs to be tested directly on an Octavo board, but can still be compiled on a full Windows or Linux system.

 

 
 
comments powered by Disqus