Shortnote

Mono is an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET and designed to allow developers to easily create cross platform applications. Wizardry and Steamworks has ported the mono framework to iOS devices for jailbroken devices as an alternative to MonoTouch.

While MonoTouch focuses on development of graphical applications for iOS using native interfaces, the Wizardry and Steamworks mono port focuses on command-line applications written in C# and can possibly use X.Org (available in Cydia) for graphics.

The package provided by Wizardry and Steamworks allows you to compile C# code up to .NET profile 4.5 as well as run executables created on a different machine.

Download

Creating, Compiling and Running an Application

First, use some editor, either joe or nano on your iOS device to create a file called HelloWorld.cs with the following contents:

HelloWorld.cs
using System;
 
namespace HelloWorld {
  internal class HelloWorld {
    public static void Main() {
      Console.WriteLine("Hello World!");
    }
  }
}

Next, in the same directory that you created the file HelloWorld.cs, we use the dmcs compiler to compile HelloWorld.cs:

mcs HelloWorld.cs

This will result in a new file being created by dmcs called HelloWorld.exe. Now we can run this file using the mono interpreter:

mono HelloWorld.exe
Hello World!

Compiling Mono on iOS

The steps below are only necessary if you wish to recompile mono on your iOS device - they are notes on the compilation procedure kept here for referential purposes. Otherwise, just install download the mono package from above.

Mono version 3.0.1 compiles with some changes to the source and some additions to the base operation system provided by the jailbreak.

Note on Pre-requisites

In order to build mono, you need a fully working build system on your iOS device. That implies a gcc compiler along with the necessary SDK files - essentially, this means that you can compile a "hello world" C program on your device. This cannot be distributed through Cydia due to the licensing issues of the OSX iOS SDK that contains the required headers and libraries to get gcc working on iOS devices. We have covered creating a build environment on the iOS Homebrew page. Please refer to that page before attempting to build mono.

The mono-build.sh script provided at the end of this page will probe for the necessary utilities and fail if they are not present. You may have to go back and forth and install packages from Cydia till all requirements are met.

Copying CoreFoundation to iOS

The CoreFoundation needs to be copied from the iPhoneOS SDK (in our case, this is the 4.3 SDK):

cd /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/CoreFoundation.framework
bash-3.4# scp -r * root@DEVICE_IP:/System/Library/Frameworks/CoreFoundation.framework/

where the DEVICE_IP is the IP of the iOS device.

The headers contained in the CoreFoundation are needed to build mono.

Using the Build Script

You need two files from the Index section below:

  • mono-build.sh - the build script that downloads, compiles, signs and builds the mono DEBIAN package.
  • mono_ios.patch - the patch that contains the modifications necessary to build mono.

Download both these files and place them in the same directory. Then, execute:

./mono-build.sh

that will take you through the process of compiling mono. The build process will take a considerable long time but provided that the required dependencies are in order, the package should be built. Our test build-system was an iPad running at iOS version 4.2.1 and took around 4 hours to complete.

The build system uses the /tmp directory to store intermediate preparations and the final Debian package will be available at /tmp/mono.deb if the build succeeds.

Thanks

We would like to thank:

  • Jay Freeman (saurik) for providing hints in order to reduce the size of the package.
  • Optimo (BigBoss) for suggesting Telesphoreo as a suitable venue for the package.
  • Zed (WaS) for advice on the build-system.

Index


ios/mono.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.