Adding a fully-bootstrapped Mono:
- In 2016, a Mono package was introduced but later removed due to prebuilt binaries. A new Mono package was added in 2024 via a patch series.
- The author started working on a Mono package to meet the dependency of a C# package requiring C# 12.0 features.
History:
- Mono and Portable.NET were competing free software implementations in the early 2000s with different goals, licenses, and methods.
- Portable.NET was decommissioned in 2012 but its source is still available. The author used pnet-git for bootstrap efforts.
The start:
- Mono-1.2.6 initially failed due to C# and Java's compile-time library dependency issue. The runtime in mono-1.9.1 was modified to allow version override.
- From there, it was a trial-and-error process to identify bitrotted areas and switch to Mono's homebrewed sgen garbage collector.
A concerning development:
- Mono started using git submodules with the
git://
protocol in mono-2.11.4, which GitHub dropped support for in 2021. - This led to issues with recursive clones and update processes, but the transparency of git mitigates the security risk.
- Mono started using git submodules with the
Meanwhile, in reality:
- Mono added a roslyn-binaries submodule in 2016, which contained binary blobs for Microsoft's Roslyn compiler.
- This raised concerns about potential security risks and the importance of bootstrappability.
Another note on roslyn-binaries:
- Writing a self-hosting compiler and relying on Microsoft's C# compiler is a bittersweet situation.
- The dependencies on new C# features are in Mono's standard library, not the compiler.
More binary submodules:
- There were binary-reference-assemblies and xunit-binaries submodules containing prebuilt blobs.
- Debian only runs tests in certain subdirectories due to these binary blobs.
The long march through the 5.0s:
- The 5.0 series was challenging due to Mono's acquisition by Microsoft and its dependency on Microsoft's corefx library.
- It took many versions and nontrivial patching to get through the 5.0 series.
The final stretch:
- The author realized the dependencies on new features were from corefx and cherry-picked mcs commits to jump to building 6.12.0.
The finishing touches:
- The author patched Mono's xbuild condition parser and added a
<runpath>
element to per-assembly config files.
- The author patched Mono's xbuild condition parser and added a
Future work:
- Dotnet builds heavily depend on binary blobs and there are portability issues with the current bootstrap path.
- Porting mcs to Portable.NET could solve these issues and make the bootstrap path more appealing.
Closing thoughts:
- The maintenance of Mono was transferred to WineHQ. The author disputes Mono's claim of being the first.NET implementation on Linux.
- The author thanks the DotGNU project, Adam Faiz, and the Mono project.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。