Skip to content
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

Aspnetcore doesn't look for linux-musl nupkgs when building on linux-musl platform #39822

Open
ayakael opened this issue Jan 26, 2022 · 6 comments
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Comments

@ayakael
Copy link

ayakael commented Jan 26, 2022

Aspnetcore looks for linux-x64 version of nupkgs that, under Alpine, should be linux-musl-x64.

Provisional patch follows:

From 9f21622ae208f49adddf9e8465295229661579ec Mon Sep 17 00:00:00 2001
From: "build@apk-groulx" <build@apk-groulx.praxis>
Date: Thu, 20 Jan 2022 01:12:07 +0000
Subject: [PATCH 1/1] build_fix-musl-build

---
 repos/aspnetcore.proj | 1 +
 repos/installer.proj  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/repos/aspnetcore.proj b/repos/aspnetcore.proj
index ad9d77885..0cefccee1 100644
--- a/repos/aspnetcore.proj
+++ b/repos/aspnetcore.proj
@@ -5,6 +5,7 @@
     <!-- StandardSourceBuildArgs include -publish which is not supported by the aspnetcore build script. -->
     <BuildCommandArgs>$(StandardSourceBuildArgs.Replace('--publish', ''))</BuildCommandArgs>
     <!-- The arch flag (defaults to x64) overrides any value of TargetArchitecture that we might set -->
+    <BuildCommandArgs>$(BuildCommandArgs) --os-name linux-musl</BuildCommandArgs>
     <BuildCommandArgs>$(BuildCommandArgs) --arch $(Platform)</BuildCommandArgs>
     <BuildCommandArgs>$(BuildCommandArgs) --no-build-repo-tasks</BuildCommandArgs>
     <BuildCommandArgs>$(BuildCommandArgs) /p:BuildNodeJs=false</BuildCommandArgs>
diff --git a/repos/installer.proj b/repos/installer.proj
index 712d7cd14..cca5295f9 100644
--- a/repos/installer.proj
+++ b/repos/installer.proj
@@ -25,7 +25,7 @@
     <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
     <BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>
 
-    <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreSharedFxInstallerRid=linux-$(Platform)</BuildCommandArgs>
+    <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreSharedFxInstallerRid=linux-musl-$(Platform)</BuildCommandArgs>
     <!-- core-sdk always wants to build portable on OSX and FreeBSD -->
     <BuildCommandArgs Condition="'$(TargetOS)' == 'FreeBSD'">$(BuildCommandArgs) /p:CoreSetupRid=freebsd-x64 /p:PortableBuild=true</BuildCommandArgs>
     <BuildCommandArgs Condition="'$(TargetOS)' == 'OSX'">$(BuildCommandArgs) /p:CoreSetupRid=osx-x64</BuildCommandArgs>
-- 

Better implementation would involve, either Aspnetcore automatically setting os-name to linux-musl when building, or repos/aspnetcore.proj automaticallty adds the above BuildCommandArg. Ditto on repos/installer.proj for setting AspNetCoreSharedFxInstallerRid,

Made as part of Alpine Linux dotnet6 packaging project, see dotnet/source-build#2782

@ghost ghost assigned MichaelSimons Jan 26, 2022
@MichaelSimons MichaelSimons transferred this issue from another repository Jan 27, 2022
@omajid
Copy link
Member

omajid commented Jan 27, 2022

Could/should we push this logic/fix into aspnetcore itself? I identified several other cases that would break in the ASP.NET Core builds a few months ago, including linux-musl-arm64: #37400

@MichaelSimons MichaelSimons transferred this issue from dotnet/source-build Jan 27, 2022
@MichaelSimons
Copy link
Member

[Source-build triage] We agree with @omajid's suggestion that the preferred place to fix this is within aspnetcore itself. If guidance is needed, reach out to @dotnet/source-build-internal.

@mkArtakMSFT mkArtakMSFT added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jan 28, 2022
@mkArtakMSFT
Copy link
Member

[Source-build triage] We agree with @omajid's suggestion that the preferred place to fix this is within aspnetcore itself. If guidance is needed, reach out to @dotnet/source-build-internal.

Thanks @MichaelSimons. Do you think this is something we must fix? I'm trying to gauge the urgency and importance of this.

@MichaelSimons
Copy link
Member

@mkArtakMSFT - Must is a little strong. I would classify this as something we should fix/accept. This makes is easier for distro maintainers to build .NET from source. With the unified build investments being made in .NET 8 we want to support a true open source upstream vs what we have today where upstream is mostly Microsoft's variant.

@wtgodbe wtgodbe added this to the Infrastructure milestone Jan 31, 2023
@ayakael
Copy link
Author

ayakael commented Sep 7, 2023

Considering the move to portable RIDs as default for source-build starting with .NET8, this should be worked on. Right now, I'm unable to build dotnet8 when TargetRid=linux-musl-x64 rather than alpine-3.18-x64. I've identified eng/Common.props as the culprit, as it sets TargetOsName=linux rather than the expected TargetOsName=linux-musl. Logics should be put in place to detect if the platform is Musl, and set TargetOsName=linux-musl

@ayakael
Copy link
Author

ayakael commented Sep 7, 2023

A related issue is #37400, failing the build on non-x64 platform. A workaround is setting /p:BuildOSName=linux-musl in addition to --os-name linux-musl. The installer changes in the the first workaround wasn't necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

No branches or pull requests

7 participants
@omajid @MichaelSimons @wtgodbe @ayakael @mkArtakMSFT and others