dotnet / source-build

A repository to track efforts to produce a source tarball of the .NET Core SDK and all its components
MIT License
266 stars 132 forks source link

Make Source-Build Portable Build Compatible #4418

Open ellahathaway opened 4 months ago

ellahathaway commented 4 months ago

Based on https://github.com/dotnet/sdk/pull/40843, it's clear that while the VMR is configured to be portable, source build does not work in a portable state due to bugs.

For example, while certain OSs build successfully with PortableBuild=true (centos9 for example), the produced SDK does not work. An example is the following run of the scenario tests with a source-build SDK that was built using the PortableBuild=true property:

System.InvalidOperationException : Failed to execute /vmr/artifacts/obj/extracted-dotnet-sdk/dotnet new console --name SdkTemplateTestsComplex_Console_CSharp --output /vmr/artifacts/scenario-tests/artifacts/SdkTemplateTestsComplex_Console_CSharp --language "C#"
    Exit code: 145
    9.0.100-preview.5.24266.1 [/vmr/artifacts/obj/extracted-dotnet-sdk/sdk]
    The command could not be loaded, possibly because:
      * You intended to execute a .NET application:
          The application 'new' does not exist.
      * You intended to execute a .NET SDK command:
          A compatible .NET SDK was not found.

Another example of source-build being portable build incompatible is the fact that aspnetcore fails to build on alpine:

/vmr/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj : error NU1100: Unable to resolve 'Microsoft.NETCore.App.Crossgen2.linux-x64 (>= 9.0.0-preview.5.24262.2)' for 'net9.0'. PackageSourceMapping is enabled, the following source(s) were not considered: prebuilt, previously-source-built, reference-packages, source-built-command-line-api, source-built-emsdk, source-built-msbuild, source-built-nuget-client, source-built-roslyn, source-built-roslyn-analyzers, source-built-runtime, source-built-source-build-externals, source-built-symreader, source-built-transport-arcade, source-built-transport-cecil, source-built-transport-emsdk, source-built-transport-msbuild, source-built-transport-roslyn, source-built-transport-runtime, source-built-transport-xdt. [/vmr/.dotnet/sdk/9.0.100-preview.5.24257.1/NuGet.targets]

In the above error message, aspnetcore fails to build because it is looking for the linux-x64 version of crossgen. Earlier, this package was built and outputted as Microsoft.NETCore.App.Crossgen2.linux-musl-x64. See https://github.com/dotnet/sdk/pull/40843#issuecomment-2125740662

dotnet-issue-labeler[bot] commented 4 months ago

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.

MichaelSimons commented 4 months ago

Is this a duplicate of https://github.com/dotnet/source-build/issues/2932?

ellahathaway commented 4 months ago

Is this a duplicate of https://github.com/dotnet/source-build/issues/2932?

It's similar/has the same end goal. I think the difference is that as of the creation of the current issue, we have the ability to "technically" build source-build with a portable RID/portable build property set, but the build itself is not actually portable due to bugs. Not sure if that was possible when Rich created the other issue?

omajid commented 4 months ago

See https://github.com/dotnet/installer/pull/15163#issuecomment-1873396096 for a fix that Nix folks used.