Mono on OpenPandora

I just found out that Mono is available in whatever repository the OpenPandora uses.

private:~$ sudo opkg list|grep "^mono "
mono - 2.6.3-r0.1.6 - Mono Programming Language

I am installing it now.

Version 2.6 is a few years old (2009) but newer than Novell's Long-Term supported version. I don't know if there even are ARM builds of more current versions.

Mono finished installing with a few errors about not being able to create a few symlinks.

private:~$ mono --version
Mono JIT compiler version 2.6.3 (tarball Fri Mar 18 15:18:29 CET 2011)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
TLS:normal
GC:Included Boehm (with typed GC and Parallel Mark)
SIGSEGV:normal
Notifications:epoll
Architecture:armel,soft-float
Disabled:none

Turns out it didn't install a C# compiler. I'll look for it.

private:~$ sudo opkg list|grep "^mono.*mcs "
mono-gmcs - 2.6.3-r0.1.6 - Mono Programming Language
mono-mcs - 2.6.3-r0.1.6 - Mono Programming Language

Grand. Which of the two compilers should I install? Both?

The Mono Project Web site says that historically several compilers existed but that mcs is a newer unified compiler. However, that explanation refers to Mono 2.11, which is so current it's not even the current release version.

I guess my mcs here is not that mcs.

The package descriptions don't give it away either, so I'll install both.

Finally, all I found is a binary named "mcs1" and no mcs or gmcs at all.

private:/$ find . -name "*mcs*" 2>/dev/null|grep bin
./usr/bin/mcs1

Anyway, mcs1 appears to be the compiler.

To test it, I decided to write a Hello World program.

Emacs doesn't have a C# mode, indentation doesn't work very well.

I found a C# mode file here: http://www.emacswiki.org/emacs/csharp-mode.el

I put the file in ~/.emacs.d/lisp and edited ~/.emacs thus:

(add-to-list 'load-path "~/.emacs.d/lisp/")
(autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
(setq auto-mode-alist
(append '(("\\.cs$" . csharp-mode)) auto-mode-alist))

Now emacs HelloWorld.cs creates quite a nice environment for C# development.

Screen Shot 2012-08-01 at 00.20.41

Compiling worked:

private:~$ mcs1 HelloWorld.cs
private:~$ ls HelloWorld*
HelloWorld.cs HelloWorld.cs~ HelloWorld.exe

Mono is missing the mkbundle command so I cannot compile the MSIL assembly into native code. But I can run the MSIL assembly.

private:~$ mono HelloWorld.exe
Hello, world.
private:~$

So that appears to work.

At some point I'll add Gtk# and hope that GUIs work in the OpenPandora's X screen.


Links

Microsoft .NET Framework: http://www.microsoft.com/net

Mono Framework: http://www.mono-project.com


 © Andrew Brehm 2016