Skip to content

[x64/Linux] Crossgen fails loading 'System.Runtime, Version=4.2.1.0' #11618

@kterhorst

Description

@kterhorst

(0.) Delete ~/.dotnet and ~/.nuget to get a fresh linux .NET Core environment.

  1. Download a .NET Core build (3.0.100 preview in this case); same problem with 2.1 and 2.2 in the past. Extract to "~/Downloads/dotnet-sdk-3.0.100".
  2. Create a simple application. Run "~/Downloads/dotnet-sdk-3.0.100/dotnet new console" in some directory. Here it is ~/tmp/crossgentest.
  3. Publish the app:
    ~/tmp/crossgentest/bin/Debug/netcoreapp3.0/linux-x64>$ ~/Downloads/dotnet-sdk-3.0.100/dotnet publish --self-contained --runtime linux-x64
    Now the resulting linux-x64 directory should contain all binaries to run/crossgen the app.
  4. Copy crossgen from "/home/klaus/.nuget/packages/runtime.linux-x64.microsoft.netcore.app/3.0.0-preview-27122-01/tools" to the linux-x64 directory.
    (Running crossgen directly from this directory results in "System.Private.CoreLib.dll not found".)
  5. Run
    ~/tmp/crossgentest/bin/Debug/netcoreapp3.0/linux-x64>$ ./crossgen crossgentest.dll
    Error: Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
    (Exception from HRESULT: 0x80070002)
    Error compiling crossgentest.dll: Could not find or load a specific file. (Exception from HRESULT: 0x80131621)
    Error: compilation failed for "crossgentest.dll" (0x80131621)

In my case it always fails at this point. I even compiled a custom CoreCLR build but still get the same error. My aim is to crossgen the .NET core binaries to improve the startup time.

My linux build is: Linux anarchy 4.18.16-arch1-1-ARCH dotnet/coreclr#1 SMP PREEMPT Sat Oct 20 22:06:45 UTC 2018 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions