-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alpine Linux dotnet31 / dotnet5 package #2695
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
According to am11 on dotnet/runtime#62942, future best practice is moving away from non-portable builds given the maintenance headaches it represents for very little upside. I am currently playing around with this on the APKBUILDs, which would slim down the patchset considerably. |
cc: @dagood |
You should consider following the standard package naming (used by Microsoft, Red Hat, and Fedora): https://docs.microsoft.com/en-us/dotnet/core/distribution-packaging. As far as I can tell, the names As for non-portable builds, I haven't worked on .NET since Nov 2021, but dotnet/runtime#62942 seems to me to only be highlighting the Microsoft perspective, not the needs of Linux distros. That thread talks about it as a legacy feature, but last I saw, it is in active use by Red Hat and Fedora. A "portable" build is an unusual concept for a tool that ships in a Linux distro. That said, as far as your work goes: if Alpine doesn't need non-portable builds, you don't need to implement them. I'll let the source-build triage process get around to this issue for an official response, but putting in my two cents. 😄 |
Thanks for your two cents, much appreciated.
Indeed, I had first followed the standard package naming, but after various conversations it was deemed more desirable to follow Alpine's convention for multiversionned packages (i.e python3 and php8). That said, I have not received a response from any Alpine developpers on that matter, so it could go either way. As for subpackages, the following are implemented: dotnet-host, dotnet-sdk, dotnet-runtime, dotnet-targeting-pack, aspnet-runtime, aspnet-targeting-pack, and netstandard-targeting-pack.
Quite so! I found the position odd, given that it seems counter-intuitive for portable builds on non-portable packages. Why have portable bits generated for non-portable applications? On the other hand, given the headache RIDs bring to the table for package maintainance, why bother when package managers insure library installation? Just yesterday, I had a reoccurence of bug dotnet/runtime#50739, causing an odd segmentation fault. It was due to source-build using version 5.0.0 of MicrosoftNETCorePlatformsPackage rather than the up-to-date (and patched by myself for Alpine 3.15) 5.0.4. Version 5.0.0 only had RIDs till 5.12, causing an obscure segmentation fault with error code 0x000000000000e5c6 in ?? () on any runtime builds past that version. Could you expand on the benefits of non-portable builds? I'm partial to keeping the non-portable builds, I'm just still bewildered on why they exist given that, as far as I can tell, no distro-specific optimizations have been implemented. With that said, portable builds bring their own set of obscure build failures on Alpine, so my APKBUILD will maintain the non-portable route. I suppose the ideal workflow is for portable bits to be generated for use by the bootstrap subpackage, but keep non-portable bits for use by the distros-specific subpackage. |
Ah! Cool, I didn't spot those. I'm not sure how they work (not super familiar with this packaging system), but that sounds right. 👍
My understanding has been that dynamic linking has performance benefits over dlopen, but I can't find any info on this. A distro tooling benefit IIRC is with dynamic linking, standard packaging tools determine what the output binaries depend on by inspecting them. This allows package dependencies to be set up automatically, rather than manually tweaking it while figuring out how to build the package. (And then maintained over time.) Really, Red Hat and Fedora would be the right people to ask. I never dug into these requirements very far, but it was always a high priority for the source-build team to keep non-portable builds working. Source-build team: I think it would be great to maintain this info in some doc. 😄 dotnet/runtime and other folks could use this to justify this kind of source-build-only requirement, and keep track of new developments (if there have been any).
I think a portable SDK (prebuilt by Microsoft) would be used at the start, but the first SDK you build (to put in a bootstrap package) would make sense as a non-portable SDK. That actually seems best, so that it matches the final output and resembles a "real" N-1 => N build that will be done in future patch versions. Maybe this is what you're saying--I'm rusty on bootstrap terminology. Here's a doc on how the source-build team tends to think about it: https://github.com/dotnet/source-build/blob/main/Documentation/EngineeringPlanLinuxDistroRepos.md. (Note: hasn't been updated in a while, but the broad requirements haven't changed much AFAIK.) |
Hi @ayakael, thanks for working on this, it's great to see! As I understand it Davis is correct on the benefits of non-portable vs portable, but @omajid may have more details. Portable bits are generated even in non-portable builds because ASP.NET relies on having the portable runtime available. This is something which I believe is fixed in the 6.0 SDK. I think your segfault is probably due to source-build having an old version of Microsoft.NETCore.Platforms from https://github.com/dotnet/source-build-reference-packages - we tend to only update these when we run into issues. We're working on making it easier for everyone to contribute to SBRP so you'll be able to submit fixes like that yourself, but if you have it working now that should be fine. Thanks as well for upstreaming all your work - we really appreciate it! Just ping me or dotnet/source-build-internal on the PRs if any of the other maintainers have source-build-specific questions you don't have an answer for. |
@crummel I've been a lurker for too long, happy to finally share in the open source spirit :) Thanks for the explanation for the segfault! Indeed, I fixed it by patching eng/Versions.props to use the lastest 2.0.4 patched with added Alpine 3.15. Simple fix for, thankfully, a simple problem. As for portable, the package currently does not generate portable bits as I encounter strange issues while trying to build them, thus the build.sh currently with /p:SkipPortableRuntimeBuild=true. In what cases does ASP.NET rely on the portable runtime? Is it something that I should hold merge for as I try to figure out the issues with the portable build? Also, another question: there's a step towards the end when a large Private.Source.Build.Artifacts is downloaded. Sometimes this fails, thus halting the build. I understand that there's a way to locally generate that file, is there not? Any pre-built binaries should be provided by the -stage0 package, while anything built using the main package should be locally built, and provided by the -bootstrap-* subpackages. It also happens to be my current roadblock with dotnet 6, as the downloaded Private.Source.Build.Artifacts does not have musl binaries, thus failing the build when ilasm fails with error code 127 (edit, actually error code 139) (presumably referring to not finding the required libc libraries). |
Just as I finished writing the last post, @omajid answered the Artifacts question on #2782. That'll at least allow me to go forward on dotnet6, although I'm still lost on how to locally build Private.Source.Build.Artifacts for proper N-1 => N so that all binaries in the post-initial build bootstrap have been built within an Alpine environment. Indeed, dotnet31 and dotnet5 currently fails to build against the current state of Alpine's edge repository (rolling testing repo), presumably due to a change in libraries that are yet to be identified. In dotnet31's case, ilasm is missing something, but the segmentation fault leaves much to be desired as far as useful information. I have yet to find time to debug the dotnet5 failure. I'm naively hoping that whatever issues will clear up because debugging segmentation faults is my least favorite activity. At least everything builds find against the current (edIt: stable) version of Alpine. edit edit jan-07-22 |
A contributor on Alpine's aports has brought up the issue of EOL. Given dotnet5's EOL of May 2022, is it worthwhile for me to continue working on this package? Any chances that they'll be an LTS for 5.0? Also note, since I've removed dotnet5's need for dotnet31-runtime, their two builds are now decoupled, thus the packages are now in two different merge requests on Alpine's gitlab for ease of development. |
I can't put myself in your shoes, but if someone had asked me to add .NET 5 to a Linux distro, I would simply tell me that I won't; it's too close to EOL. If a user has been using .NET 5 on alpine until now using some other mechanism, they can continue doing that for the next 4 months or so too. If they are looking to adapt .NET for a fresh project, 5.0 is a bad idea to start with since it's EOL is so close.
None that I can see. Microsoft has stated that alternate releases are LTS. 3.1 is LTS (EOL December 3, 2022) and 6.0 is LTS (EOL November 8, 2024). They have also said that next LTS will be 8.0. 5.0 is not and will not be LTS. See https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core#cadence for details. |
Hey, @ayakael are you also packaging up https://github.com/dotnet/source-build-reference-packages/ ? Both 3.1 and 5.0 need it if you are going to use the N-1 build to build the N version of source-build. 6.0 also uses it, but automagically under the hood. For 3.1 and 5.0, you will need to explicitly build it and consume it in source-build, by placing it at |
@omajid Thanks for the heads up! No I don't, I'll get to doing that shortly. |
@omajid Is SBRP designed to be built after the first local build? That is to say, current practice does the following:
In this, where does SBRP fit? Should dotnet5-stage0 build it in step 1, creating a dotnet5-stage0-reference package, providing dotnet5-bootstrap-reference? Or is this something that should be built between step 2 and 3 as its own special package that should only be built with dotnet5-{sdk,runtime,artifacts} and not dotnet5-stage0-{sdk,runtime,artifacts}? Or both? As it is right now, ilasm pulled by SBRB fails to execute due to pulling libc ilasm rather than musl ilasm. I suspect this would be fixed with the Private.Artifacts file built in step 2, thus suggesting this 3rd package should be built between step 2 and 3. |
The prebuilt version of SBRP ( When you have the N-1 build of source-build, you can use that to build SBRP. When you have built SBRP yourself, it should be used to build the "true N" build. |
I'm hitting a wall in step 2: Private.SourceBuild.ReferencePackages.$ver.tar.gz and Private.SourceBuilt.Artifacts.$ver.tar.gz aren't being pulled by dotnet5 build. (i.e., online versions are downloaded regardless of them being there or not) edit fixed by removing /p:ArchiveDownloadedPackages=true |
For Artifacts and ReferencePackages, is there a way for source-build to injest *.nuget files rather than *.tar.gz? I'm bothered that I'm packaging (i.e. compressing) a file that's already compressed. Alpine's APK agrees as it doesn't like managing large (2GB+) files. I could always recompress them on build for source-build to decompress them. And indeed, known-good still downloads those files. I thought I had fixed it, but I was wrong. I'm not quite sure what's up, but I'll investigate tomorrow and see if they're any flags I should set. Also, what does /p:ArchiveDownloadedPackages=true do? |
Is this 5.0? Looking at the sources,
Not quite 100% sure I understand If that understanding is correct, this would have a couple of uses:
|
I'm trying a rebuild with those flags which will hopefully work, but for the problematic logs, voilà: https://gitlab.alpinelinux.org/ayakael/aports/-/jobs/588313/raw look for Private.SourceBuild.ReferencePackages, you'll see known-good redownloading those files. |
No dice for ReferencePackages with SkipDownloadingReferencePackage, but SkipDownloadingPreviouslySourceBuiltPackages works for Artifacts. See, https://gitlab.alpinelinux.org/ayakael/aports/-/jobs/589171/raw |
Sorry, I had a typo. It's |
Perfect, that did it! |
I see that Fedora runs with /p:SkipPortableRuntimeBuild=true, as do I in the Alpine build. Is there any issue to skipping the building of the portable runtimes, other than not being able to go across distro versions? I figured that I should eventually get portable runtime builds going for proper bootstrap packages to be able to run across distro versions. Why does Fedora skip that? (edit got note from Alpine developpers that portable runtimes won't be necessary for bootstrapping, as they'll automatically build stage0 package at every new-version avoiding manually transferring N-1 bootstraps. As long as lack of portable runtimes won't make anything unhappy, I'll do like Fedora pkg and skip building them) Also, in investigating getting the arm64 builds going, I see that Microsoft does not publish SDKs of dotnet-3.1 for linux-musl-arm64, but does publish runtimes for linux-musl-arm64. Are there long forgotten SDK binaries somewhere I can use to have stage0 be able to pull something for arm64? |
I also see that dotnet-build-reference-packages pkg on Fedora is at version 11. I have yet to see any mention of a versioning scheme for SBRP much to my dismay. Where did you get that version number? Is it in-house to fedora? |
Of note: Alpine devs indeed prefer maintaining the $pkgname$macroversion-$subpkgname naming scheme rather than Microsoft's $pkgname-$subpkgname-$macroversion. I've mitigated this issue by creating virtual packages that translate Microsoft -> Alpine. Thus: I'm wrapping up dotnet5 and dotnet31, now that references and artifacts are now packaged (in dotnetx-artifacts and dotnetx-references, respectively). I've also added a zsh and bash completions provided here in their own subpackages, per Alpine's standards. |
AFAIK, it was a bunch of accidents that lead to this state. Fedora was probably the earliest consumer of source-build. In fact, I think it started consuming source-build before the portable runtime build was added (IOW, only non-portable was being built when .NET was bootstrapped and added to Fedora). When the portable build was added to source-build, we could either re-bootstrap or skip the portable runtime build. Skipping the build worked in the sense it produced working artifacts, so that's what we ended up doing, rather than the more expensive (in terms of dev time) re-bootstrap. It hasn't caused any issues until now, so we have kept skipping the portable build for 3.1 and 5.0.
SBRP doesn't have official release numbers, so the versioning in Fedora is made up. The Fedora SBRP package tries to follow Fedora's suggestions for what to use as a number when upstream (ie, SBRP) doesn't do releases. What you want to do is to make sure the version of SBRP is the same as the commit listed in the
If/when the commit sha doesn't match, you should update SBRP to match this commit sha.
Nice! The bash completion script is also in the repo, and you can just The zsh completion is actually broken if you install it as a standard completion. There's a (stalled) fix here: dotnet/sdk#14239 |
Awesome! Thanks for all the notes. A relief that skipping runtime builds is okay, it would've been a process to fix 'em on musl. Completely implemented a references package. Unfortunately, the merge request is stalling because of a versioning issue. Current building infrastructure does not support assigning versions to each package. I've found a possible solution, but it's going to take a moment to figure out if that's going to break the build servers haha. I'm not liking the idea of omitting either SDK versions or runtime versions, and whatever versioning scheme we decide on, it'll be an awkward process changing it in the future. Might as well get it right the first time. Time to fully tackle dotnet6! |
I'm encountering an issue with dotnet5's roslyn relating to ingesting Private.SourceBuilt.Artifacts. It is unable to find
Using prebuilt artifacts doesn't have this issue, and dotnet31 builds without issue using post-build artifacts. Any idea what this might be? edit
|
Further investigations has pulled up that roslyn's So if I copy This leads me to wonder if there's a build flag that can add a nuget feed, allowing pulls from other directories than blob-feed-packages. I need to further investigate Private.Sourcebuilt/x*.tar.gz ingesting logics. |
Fixed the above issue by adding a NuGet repo pointing to /usr/share/dotnet/artifacts, allowing it to pull the missing nupkg. Terrific news: this means that both dotnet31 and dotnet5 are now fully capable of building on themselves! |
Generally, what causes the following errors, other than not having that exact NuPkg?
Is there a way to regenerate PackageVersions.props, or have build process be more relaxed on versioning? |
Hm. Are you trying to build 3.1.416 using an older version? Unfortunately the previous version was a 3.1.1xx release and going from 3.1.1xx to 3.1.4xx requires a re-bootstrap. Other than that, going from one minor 3.1 release to next (without skipping versions), I wouldn't expect to see this error. |
Package was merged into Alpine's aport succesfully. Packaging is thus done for dotnet31 and dotnet5. Closing. |
I've been working on an Alpine Linux package for dotnet31, dotnet5 and dotnet6 package for the past few months. dotnet31 and dotnet5 are finally ready, and is in the process of being merged here:
dotnet31: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/28197
dotnet5: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/28195
Build for dotnet31 and dotnet5 required many patches, as the build process wasn't without kinks on Alpine. Below you'll find the patch notes for each build. For upstreaming these fixes, I'm going ahead and sending merge requests to their respective repos.
Patch notes for dotnet31
Patch notes for dotnet5:
I'm open to any comments on the Alpine package. I've heard from various voices that this is something many have been wating for, so I'd like this space to also be a place of discussion in case there's a better way to do certain things on my APKBUILD. I have very little experience with the .NET framework, I'm just someone who likes creating packaging scripts.
For dotnet6, please see #2782
The text was updated successfully, but these errors were encountered: