Mono Port To IBM i Now Available
October 31, 2018 Alex Woodie
IBM i shops that want to run Microsoft .NET can now do so through the Mono middleware, which was officially ported to IBM i and AIX earlier this year by the Mono community. While the port is not feature complete, Mono can now run on IBM i 7.1 and higher via the PASE AIX runtime. It’s not a native port, but it’s better than nothing.
Mono is an open source implementation of Microsoft’s .NET Framework, including a C# compiler and the Common Language Runtime (CLR), that allow .NET applications to run on non-Windows platforms, including Linux, MacOS, BSD, various flavors of Linux, and even video game consoles like Xbox and PlayStation.
The Mono project was originally started by Miguel de Icaza at his company Ximian, which was later acquired by Novell. After being cut loose by Novel, de Icaza in 2011 started another Mono outfit called Xamarin, which became a subsidiary of Microsoft in 2016.
There have been numerous discussion over the years about porting Mono to the IBM i operating system (not to mention adapting Windows to run Power, and adapting IBM i to run on Intel processors, but those are other stories). Microsoft’s relationship with the midrange server has been interesting, to say the least. But thanks in part to Microsoft’s newfound love of open source software – and the fact that Linux is now the most popular environment on its Azure cloud — the barriers to porting Mono to IBM i and AIX melted away and the community finally rose to the occasion and got it done.
On May 29, developer Calvin Buckley announced in a blog post on the Mono project website that the first release of the community port of Mono to IBM i and AIX was completed. Buckley did much of the work to get IBM i and AIX supported with Mono version 5.12.0, which was released earlier that month.
As Buckley explains in his blog post, there was already a port of Mono to Big Endian 64-bit PowerPC, which is maintained by Bernhard Urban. However, the modern Power RISC architecture that debuted in 2006 has evolved from the PowerPC roots, and so new work was required to get Mono running there.
In his blog post, Buckley discusses some of the work involved with getting Mono running on IBM i and AIX. His take on the IBM i architecture – including its single-level storage, object-based file system, and use of the machine interface (TIMI) – are interesting and worth the time to read, at the very least to understand how a developer who’s comfortable in the open source world views IBM’s proprietary, POSIX-compliant server.
Most of the work revolved around getting Mono on AIX and dealing with its “quirks,” including the quality of the GNU tools, issues with GCC, calling conventions, use of libraries, multi-threading, and getting Boring SSL to work. Buckley said he worked through these issues with the help of David Edelsohn from IBM.
Buckley stated that the main goal of the project was to get Mono running on IBM i, which he said several IBM i users have been asking about. Buckley had experience porting Mono to other platforms, and they approached him to see if he could do the same for IBM i. However, since a native ILE port would require a considerable amount of work, the developer decided to take the PASE AIX runtime route to running on the box.
Buckley stated that “PASE has many quirks,” and that it required some patches to work around deficiencies, including bugs and unimplemented functions. “I aim to target IBM i 7.1 or newer, so I worked around some bugs that have been fixed in newer versions,” he wrote. “A lot of this I cleaned up with some more preprocessor definitions.”
Getting the Mono runtime up and running on IBM i took a bit more work. The initial performance of Mono on IBM i wasn’t good. Buckley said that the Mono build on IBM i took was about 10x longer than the AIX build due to the configuration script being “extremely impacted due to its emphasis on many small reads and writes with lots of forking.”
Due to a “strange calling convention” with AIX, the ahead-of-time compiler does not work for Mono on IBM i and AIX. “While most Unix-like operating systems use ELF, AIX (and by extension, IBM i for the purposes of this port) use XCOFF, a subset of the Windows PE binary format,” he writes.
While there’s still a bit of work to do around the ahead-of-time compiler, getting continuous integration to work, and various other items, the port to IBM i and AIX is ready to be used, Buckley said. “Despite all this, the fact the port works well enough already in its current state should provide a solid foundation to work with, going forward,” Buckley writes.