runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Unable to restore native shims for runtime ID 'centos.7-x64'

Open Sridhar-MS opened this issue 10 years ago • 10 comments

Repro steps

  • Create a project with reference to "NETStandard.Library": "1.0.0-rc2-23616" or download from here
  • Restore the packages using the below command on any OS.

dnu restore --runtime "centos.7-x64" --source "https://www.myget.org/F/dotnet-core/api/v3/index.json" <path to project>\project.json

Microsoft .NET Development Utility CoreClr-x64-1.0.0-rc1-16231

CACHE https://www.myget.org/F/dotnet-core/api/v3/index.json Restoring packages for D:\helloworld\project.json CACHE https://www.myget.org/F/dotnet-core/api/v3/flatcontainer/runtime.centos.7.1-x64.microsoft.netcore.runtime.coreclr/index.json CACHE https://www.myget.org/F/dotnet-core/api/v3/flatcontainer/runtime.centos.7.1-x64.microsoft.netcore.runtime.coreclr/1.0.1-rc2-23616/runtime.centos.7.1-x64.microsoft.netcore.runtime.coreclr.1.0.1-rc2-23616.nupkg Installing runtime.centos.7.1-x64.Microsoft.NETCore.Runtime.CoreCLR.1.0.1-rc2-23616 Writing lock file D:\helloworld\project.lock.json Restore complete, 961ms elapsed

NuGet Config files used: C:\Users\sridhper\AppData\Roaming\NuGet\nuget.config

Feeds used: https://www.myget.org/F/dotnet-core/api/v3/flatcontainer/

Installed: 1 package(s) to C:\Users\sridhper.dnx\packages

As you can see from the dnu output only the CoreCLR runtime package gets installed. The native shims are not getting downloaded. The workaround is to use 'centos.7.1.-x64' as the RID.

Note - The RID “centos.7-x64” does import “centos.7.1-x64” as seen here and in dnx.

Sridhar-MS avatar Dec 18 '15 19:12 Sridhar-MS

This appears to be due to the way the RID graph walk is happening.

We define centos.7-x64 as

        "centos.7-x64": {
            "#import": [ "centos.7", "centos.7.1-x64" ]
        },

Depth first would traverse all the way down the centos.7 branch and hit base where we have:

      "runtime.native.System": {
        "runtime.native.System": "4.0.0-rc2-23616"
      },

This entry at base is a lifting entry. We include it for all packages because it addresses the issue where the first version of some packages contained windows-specific bits packaged in the referenced package. In order to prevent those from clashing with the x-plat bits we raise up the version of the package to the latest so that reference package and runtime package are consistent in the runtime graph, no overlap.

Breadth first would first hit centos.7.1-x64 where we have

      "runtime.native.System": {
        "runtime.centos.7.1-x64.runtime.native.System": "1.0.1-rc2-23616",
        "runtime.native.System": "4.0.0-rc2-23616"
      },

The reason this doesn't happen for Microsoft.NETCore.Runtime.CoreCLR is because we don't have the lifting entry in base. The reason that this doesn't happen for centos.7.1-x64 is because an exact match is found without walking the runtime graph.

I can workaround this in the packages, but this seems to be a flaw in the runtime graph walking algorithm: base (depth 7) should never be preferred over an entry at depth 1.

/cc @anurse

ericstj avatar Dec 18 '15 19:12 ericstj

Thanks @ericstj for the analysis. The current workaround is to not include a lifting entry for the native shims.

@anurse Which is the right repo to followup on the runtime graph walking algorithm? https://github.com/aspnet/dnx?

Sridhar-MS avatar Dec 18 '15 22:12 Sridhar-MS

That would go to https://github.com/NuGet/Home. Make sure it is clear that this is related to the project.json runtime resolution algorithm :)

analogrelay avatar Dec 19 '15 00:12 analogrelay

Nuget v3 is able to restore the native shims for RID centos.7-x64

D:\temp>nuget restore project.json MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. Feeds used: C:\Users\sridhper\AppData\Local\NuGet\Cache C:\Users\sridhper.nuget\packages
https://www.myget.org/F/dotnet-core/api/v3/index.json https://api.nuget.org/v3/index.json

Restoring packages for D:\temp\project.json... NotFound https://api.nuget.org/v3-flatcontainer/runtime.unix.system.io.filesystem/index.json 258ms NotFound https://api.nuget.org/v3-flatcontainer/runtime.unix.system.net.sockets/index.json 251ms NotFound https://api.nuget.org/v3-flatcontainer/runtime.native.system/index.json 255ms NotFound https://api.nuget.org/v3-flatcontainer/runtime.native.system.security.cryptography/index.json 79ms NotFound https://api.nuget.org/v3-flatcontainer/runtime.centos.7.1-x64.runtime.native.system/index.json 261ms NotFound https://api.nuget.org/v3-flatcontainer/runtime.centos.7.1-x64.runtime.native.system.security.cryptography/index.json 254ms Installing runtime.centos.7.1-x64.runtime.native.System.Security.Cryptography 1.0.1-rc2-23616. Installing runtime.unix.System.Net.Sockets 4.1.0-rc2-23616. Installing runtime.centos.7.1-x64.runtime.native.System 1.0.1-rc2-23616. Installing runtime.native.System.Security.Cryptography 4.0.0-rc2-23616. Installing runtime.unix.System.Private.Uri 4.0.1-rc2-23616. Installing runtime.linux.System.Net.NameResolution 4.0.0-rc2-23616. Installing runtime.centos.7.1-x64.Microsoft.NETCore.Runtime.CoreCLR 1.0.1-rc2-23616. Installing runtime.unix.System.IO.FileSystem 4.0.1-rc2-23616. Installing runtime.native.System 4.0.0-rc2-23616. Installing runtime.unix.System.Net.Primitives 4.0.11-rc2-23616. Installing runtime.unix.System.Diagnostics.Debug 4.0.11-rc2-23616. Installing runtime.unix.System.Threading 4.0.11-rc2-23616. Installing runtime.linux.System.Runtime.Extensions 4.0.11-rc2-23616. Installing runtime.unix.System.Console 4.0.0-rc2-23616. Installing runtime.unix.Microsoft.Win32.Primitives 4.0.1-rc2-23616. Installing runtime.linux.System.Runtime.InteropServices.RuntimeInformation 4.0.0-rc2-23616. Installing runtime.linux.System.Diagnostics.Process 4.1.0-rc2-23616. All packages are compatible with DNXCore,Version=v5.0. All packages are compatible with DNXCore,Version=v5.0 (centos.7-x64).

So this bug is only in dnx runtime walking algorithm. And since dnx is being phased out I am not sure if this will be fixed anytime soon.

Sridhar-MS avatar Jan 04 '16 22:01 Sridhar-MS

We'll be using NuGet's runtime walking algorithm so it should be resolved when we merge.

analogrelay avatar Jan 04 '16 22:01 analogrelay

@anurse Do you mean that the NuGet's runtime walking algorithm is going to be merged with dnx? Or the xplat Nuget that will replace dnx in the CLI tools?

Sridhar-MS avatar Jan 04 '16 23:01 Sridhar-MS

The latter

analogrelay avatar Jan 05 '16 05:01 analogrelay

I will close this issue after verifying @ericstj's workaround.

Sridhar-MS avatar Jan 05 '16 18:01 Sridhar-MS

@Sridhar-MS , is it ok to close this issue now?

chcosta avatar Jan 06 '16 18:01 chcosta

Verified the fix, closing the issue now.

Sridhar-MS avatar Jan 06 '16 18:01 Sridhar-MS