3 ms·
Isn’t there a problem with bootstrapping .NET? Can I truly build from source?
by pharmakom 5y ago
Isn’t there a problem with bootstrapping .NET? Can I truly build from source?
- kevingadd 5y agoThe C# compiler for example is written in C# so you need a functioning .NET runtime in order to compile the compiler and standard library. That doesn't mean you can't build from source though, there aren't any special binary blobs you need to build .NET. For example, a csc (C# compiler) built using the open source Mono runtime will work just as well as one built using an open source build of .NET Core or one built using the .NET Framework binary blobs.
- bob1029 5y agoWhy can't we just take the existing .NET 6+ SDK product roadmap and add the bare minimum OS-level capabilities such that you could boot directly into the console of the app? I'm imagining a something like .NET 6 SDK combined with a minimal Linux distribution, and a special dotnet publish command that outputs a vhd/bin file that can be directly booted from disk. Over time, the .NET stack could consume bits and pieces of what it's hosting layer provides with objectives of totally replacing it, ship of theseus-style.
- kevingadd 5y agoThis isn't relevant enough to the average user to make it onto the SDK roadmap. If community members contributed it I bet it would probably get welcomed into the larger ecosystem though. FWIW some maintainers have been tuning .NET for Alpine Linux, so if you just want a small container to host .NET apps you should give that a try.
- pjmlp 5y agoHere if you want something bare metal style, https://www.wildernesslabs.co/ https://www.wildernesslabs.co/
- MarkSweep 5y agoThe 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).