runtime: Linux build fails randomly with "Unable to load shared library 'jitinterface_x64'" error in crossgen

Randomly my build on Debian gets stuck in a broken state where all builds fail with this:

  All projects are up-to-date for restore.
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error : Unhandled exception. System.DllNotFoundException: Unable to load shared library 'jitinterface_x64' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:  [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error : ./artifacts/bin/coreclr/linux.x64.Debug/x64/crossgen2/jitinterface_x64.so: cannot open shared object file: No such file or directory [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error : ./artifacts/bin/coreclr/linux.x64.Debug/x64/crossgen2/libjitinterface_x64.so: cannot open shared object file: No such file or directory [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error : ./artifacts/bin/coreclr/linux.x64.Debug/x64/crossgen2/jitinterface_x64: cannot open shared object file: No such file or directory [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error : ./artifacts/bin/coreclr/linux.x64.Debug/x64/crossgen2/libjitinterface_x64: cannot open shared object file: No such file or directory [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :  [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError) [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at Internal.JitInterface.JitConfigProvider.<>c__DisplayClass5_0.<Initialize>b__0(String libName, Assembly assembly, Nullable`1 searchPath) [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags) [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at Internal.JitInterface.CorInfoImpl.Startup(CORINFO_OS os) [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at Internal.JitInterface.JitConfigProvider.Initialize(TargetDetails target, IEnumerable`1 jitFlags, IEnumerable`1 parameters, String jitPath) [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at ILCompiler.ReadyToRunCodegenCompilationBuilder.ToCompilation() [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, ReadyToRunCompilerContext typeSystemContext, Logger logger) in ./src/coreclr/tools/aot/crossgen2/Program.cs:line 634 [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at ILCompiler.Program.Run() in ./src/coreclr/tools/aot/crossgen2/Program.cs:line 302 [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at ILCompiler.Crossgen2RootCommand.<>c__DisplayClass205_0.<.ctor>b__0(ParseResult result) in ./src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs:line 261 [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult) [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at System.CommandLine.ParseResult.Invoke() [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]
./artifacts/bin/Crossgen2Tasks/Debug/net10.0/Microsoft.NET.CrossGen.targets(464,5): error :    at ILCompiler.Program.Main(String[] args) in ./src/coreclr/tools/aot/crossgen2/Program.cs:line 914 [./src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj]

Blowing away artifacts fixes it temporarily but it tends to come back. This seems like a new issue, I haven’t seen it before the last couple weeks (but it’s also been a bit since I did lots of runtime builds on linux.)

See https://gist.github.com/kg/eb732af8d9d1338775ca25984f9106ae for LD_DEBUG log output and the location of libjitinterface SO files from my environment.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 18 (18 by maintainers)

Commits related to this issue

Most upvoted comments

I got this to happen on the second pass of the native runtime build. You have to run the second pass w/ libs in order to get it to error at all.

./build.sh -subset clr+clr.hosts -rc Checked -arch arm64 -hc Release --cmakeargs "-DCLR_CMAKE_APPLE_DSYM=TRUE"
 
./build.sh -subset Libs -configuration Release -arch arm64 -restore -build -rc Checked -hc Release -runtimeFlavor CoreCLR

When you run the native build the first time, the dylibs are all in the single file crossgen folder. On subsequent runs they are cleaned.

I’d say I hit this multiple times a day now.

Do you switch branches by any chance? There were some changes to how crossgen builds (and maybe which binary we run - I haven’t paid close attention) in the past week or two and I would not be surprised if they don’t play well with incremental build (clean build, switch branch/pull, followed by incremental build).

This occurs without any branch switches, just by making small changes to the mono runtime and doing a regular build.sh incremental build. Clean build (after nuking artifacts) seems to always work.

So it seems like incremental build even without a branch swap is broken.