3 ms·
The C# compiler and parts of the supporting .NET runtime are written in C#, so yes there is a bootstrapping issue. Other languages like Rust or even C compilers
by MarkSweep 5y ago
The C# compiler and parts of the supporting .NET runtime are written in C#, so yes there is a bootstrapping issue. Other languages like Rust or even C compilers written in C have this problem.
For initial porting to a new system or processor architecture, the C++ part of CoreCLR (the main runtime for .NET) can be built with CMake and LLVM on the target system. The libraries can be cross-compiled on another system that already supports .NET and copied to the target system. Some Details are here:
https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/botr/guide-for-porting.md https://github.com/dotnet/runtime/blob/main/docs/design/core...
For building from source to satisfy requirements Linux distributions, Microsoft has a system to build from source. My understanding from the last time I closely looked at it is some binary dependencies are decompiled to MSIL (the bytecode used by .NET). Since CoreCLR includes a MSIL assembler written in C++ (ilasm), it can bootstrap using these MSIL sources. But I have not looked at this project closely in a while and it evolved quite a lot while I was watching it. The system for the source build is here:
https://github.com/dotnet/source-build https://github.com/dotnet/source-build
- radicalbyte 5y agoThe "old" compiler which is written in C/C++, I don't think that it's open source though. The modern compiler - Roslyn - was explicitly re-written in C#, and is currently the main compiler (and has been for about three years now).