Support Alpine Linux (inadvertently to conform with libc for embedded systems)
musl (for Alpine), μClibc (for Alpine and Lilblue) and Newlib (for AmigaOS, Cygwin and PlayStation Portable) are standard C library implementations for embedded systems, which don't include Memory Management Unit (MMU).
If .NET team has plans to target microcontrollers/embedded-systems with coreclr, please provide support for those platforms.
Note that static lib libnix is also available for AmigaOS: http://cahirwpz.users.sourceforge.net/libnix/Description.html#Description (or https://github.com/cahirwpz/m68k-amigaos-toolchain)
Here is a list of major C standard libraries implementations: http://en.wikipedia.org/wiki/C_standard_library#Implementations
coreclr on embeded? This will be an interesting discussion to follow.
@jasonwilliams200OK are you aware of the .NET micro-framework - http://www.netmf.com/gadgeteer/ which is open source and available on GitHub @ http://netmf.github.io/
That well be an interesting discussion to follow.
Indeed. :)
/cc @smaillet-ms your thoughts?
I've been trying to get CoreCLR to build on Alpine and am stuck trying to compile libunwind. Seems that doesn't play nice with musl, specifically it doesn't have execinfo.h. Haven't looked much into any workarounds.
My goal is to eventually see if I can get ASP.NET vNext running on here, as Alpine is great for super lightweight Docker images (https://github.com/gliderlabs/docker-alpine)
Running on alpine would be awesome, since the docker image is very tiny!
Update: I have upstreamed all the local patches for Alpine Linux, one of the smallest Linux distro (~80 MBs ISO) that relies on musl-libc. It builds 99% of the CoreCLR without LLDB and event tracing (LIBLLTNG) support at the moment.
PRs: dotnet/coreclr#5726, dotnet/coreclr#5727, dotnet/coreclr#5728, dotnet/coreclr#5729, dotnet/coreclr#5730, dotnet/coreclr#5731.
This work is based on @benpye's original PR dotnet/coreclr#2262.
This is definitely interesting work. It is important to point out to those who may be following from the NETMF realms that this is NOT NETMF, but rather a port of CoreCLR to this platform. The discussion here is available due to common interests and a bit of high level overlap (embedded and .NET)
All the above mentioned PRs are merged.
Result is :100: %
Repo successfully built. Product binaries are available at /root/coreclr/bin/Product/Linux.x64.Debug alp:~/coreclr#
As of this moment, CoreCLR (without lldbplugin) and CoreFX native both build on Alpine Linux. :zap:
Once lldb package is made available (i.e. very soon), I will rebuild CoreCLR and CoreFX native and post the test results with steps-by-step gist notes on how to build these from scratch installation here.
FYI: @Barthalion, @benpye, @ellismg
Thanks to @Barthalion for porting LLDB to Alpine Linux: https://pkgs.alpinelinux.org/packages?name=lldb. :tada: :star:
Now CoreCLR master builds on Alpine with lldbplugin (without missing anything).
Running the PAL suites revealed 12 failures: https://github.com/dotnet/coreclr/issues/5872.
Will run the managed test suite once PAL suite failures are sorted out.
:thumbsup: for getting this working!
With dotnet/coreclr#5872 closed, these are the final steps to build CoreCLR on Alpine Linux: https://gist.github.com/jasonwilliams200OK/7d6f5594d3bf697a27c9c1036d349fce and running the PAL tests. Note that CoreFX native also builds on Alpine. Now the verification (running full managed assemblies tests suite) and packaging parts are remaining.
While ISO is 87MB with still lots of auxiliary stuff bundled in, the minimal Alpine is just 5MB in size (aka slimmest Linux with smallest footprints) used by docker: https://hub.docker.com/_/alpine/:/ (see description) .. the next in line is TinyCore Linux, which is 11 MB in size, but depends on glibc (i was trying to build working clang38 on it but Alpine is already 2x slimmer than TC :wink: ) ..
For packaging, would be really nice to get someone from dotnet team to provide RID for Alpine Linux and APKBUILD script in dotnet/core-setup repo so we can build that project on Alpine... (we can help with APKBUILD script but please unblock us on core-setup)
Reference: https://wiki.alpinelinux.org/wiki/APKBUILD_Reference Examples: https://github.com/alpinelinux/aports/search?q=filename:apkbuild
cc: @jkotas, @ericstj, can Alpine get special love for dotnet core v1.0-RTM? long shot, but hopefully not impossible! :blush:
@jasonwilliams200OK v1.0-RTM is out the door. It would be for the update that comes next.
@joshfree @Petermarcu How can we get started on adding Alpine Linux to the list of the officially supported distros?
@jkotas, yup but the distros packaging systems can still get v1.0 at any point. For example, lldb38 was released couple of months back but aports (Alpine packaging sys) got it 9 days ago. :)
Is the key blocker right now the RID for Alpine?
In other words, an entry here... https://github.com/dotnet/corefx/blob/master/pkg/Microsoft.NETCore.Platforms/runtime.json
@jasonwilliams200OK you said please unblock you on core-setup. Is the RID issue whats blocking you?
Folks can ammend the RID graph in their own package to try things out; any package with a runtime.json will get merged into the graph. We shouldn't be defining a RID compatibility relationship in the central MS.NETCore.Platforms until we have a chance to assess the compatibility of the distro with others/versions. That's ok to do in prerelease so long as we test it out and vet it before shipping stable.
Read through this a bit more and here are the two options I see:
- Build new packages that add Alpine to NETCore1.0. These can be done entirely on the side as I suggested above.
- Add alpine to master for CoreFx/CoreCLR. These wouldn't be using 1.0 RTM bits but could be added by modifying the existing packages. We'd probably do this anyway if we expect to make it an officially supported distro.
To get the RID added please open an issue in CoreFx and spec what the Identifier should be and how it relates to existing ones and I can add it.
If folks want to understand the work behind adding support to 1.0 on the side I can elaborate on that.
/cc @schellap for core-setup. I believe @jasonwilliams200OK needs our help to create a build script.
Supporting mentioned OSes would be really great. Thumbs up.
@Petermarcu, @ericstj,
RID is something which is required whenever we try to build anything beyond CoreCLR / CoreFX: i.e. muxer (core-setup), or else the build script assumes platform to be Ubuntu. That is why i mentioned RID.
To build functional .NET Core on any operating system which Microsoft will care about in future or not, what steps need to be taken? Here is my understanding how someone in OSS land can try building .NET core for their distro:
- CoreCLR should build on the desired platform and all PAL tests pass. If there are any patches required, send pull requests.
- CoreFX should build and all managed assembly tests pass. If there are any patches required, send pull requests.
After that we are lost because:
- CLI does not "just build on any platform". Cross-compilation is not supported?
- CLI depends on core-setup. Core-setup requires
dotnetmuxer to builddotnetmuxer (AFAICT) like roslyn requires csc to build csc.
If you can guide us how to build muxer by ourselves on the target platform or cross-compile from Ubuntu/Fedora for example, then we can build and validate everything in ports repos (aports, pkgsrc, portage, xbps etc.). For CoreFX assemblies which require platform specific native shims, we would need to publish those platform-specific partial assemblies to nuget as well.
@ericstj, at the moment, nuget and coreclr installers are identified as set of three segments:
<productName>-<operatingSystemNameOrFamily>-<operatingSystemArchitecture>
what is missing from this equation in cruntime identifier: glibc, musl, uclibc, dietlibs etc. against which the native compilation transpired. Gentoo and VoidLinux are examples which support multiple libc (in separate SKUs; in one install there is always one main libc which could be any one of the known variants).
One way to tackle it is by introducing another segment to identifier for libc name. And if that segment is missing, consider it glibc for non-windows. Something like <libc_dietlibc>, <libc_musl-libc>, <libc_uclibc>.
One way to tackle it is by introducing another segment to identifier for libc name
I do not think that replicating all nuances of platform-specific native code packaging in nuget is a path to success. I think we need to have an option to distribute and acquire the unmanaged parts via the platform-specific package manager:
System.*.Native.sowould be acquired via build from source, apt-get and friends, etc- The managed code in platform-specific corefx nuget packages would be good accross all Linux distros as long as you got
System.Native.*.sorequired by the nuget packages to the box.
It is not that different from where we are today. You need to get the unmanaged dependencies like icu or openssl via platform-specific package manager already anyway. This would push the boundary a bit higher - to match where the boundary between managed and unmanaged code actually us.
The same strategy can also be used to make corefx packages that depend on System.*.Native shims to work on mono, discussed in https://github.com/dotnet/corefx/issues/9012#issuecomment-229448951
System.*.Native.so would be acquired via build from source, apt-get and friends, etc
Meaning the recommended way for platform package manager is give the experience like: tce-install netcore to get .NET Core package on TinyCore which would include version-specific:
- Everything CoreCLR
- All System.Native.*.so from CoreFX
- Version of muxer thingy: dotnet executable + MSBuild + NuGet + csc + vbc + fsc
The rest of the NuGet packages will be fetched by corerun nuget.exe install <package-name>. Is that right?
The managed code in platform-specific corefx nuget packages would be good accross all Linux distros as long as you got System.Native.*.so required by the nuget packages to the box.
Trube, but lets suppose some non-Linux SmartOS or some non-Unix like OS requiring a "managed" partial class implementation of System.IO.FileSystem.DriveInfo, would that require to come through nuget by same vendor? Can we reliably interpose the equivalent that kind of package from another vendor in nuget such that the end use when they consume S.I.F.D, on the said platform, they get the package published by someone else (and somehow approved by original vendor)?