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

Runtime build on Loongarch failed #3130

Open
kant2002 opened this issue Nov 23, 2022 · 9 comments
Open

Runtime build on Loongarch failed #3130

kant2002 opened this issue Nov 23, 2022 · 9 comments

Comments

@kant2002
Copy link
Contributor

I disable building Crossgen in the runtime repo and try to build on Loongarch and this is what issue I'm having

Unhandled exception. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
     at Mono.Collections.Generic.Collection`1.get_Item(Int32 index)
     at ILLink.Shared.TrimAnalysis.FlowAnnotations.BuildTypeAnnotations(TypeDefinition type)
     at ILLink.Shared.TrimAnalysis.FlowAnnotations.GetAnnotations(TypeDefinition type)
     at Mono.Linker.Dataflow.DynamicallyAccessedMembersTypeHierarchy.ProcessMarkedTypeForDynamicallyAccessedMembersHierarchy(TypeDefinition type)
     at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
     at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason, MessageOrigin& origin)
     at Mono.Linker.Steps.MarkStep.MarkFields(TypeDefinition type, Boolean includeStatic, DependencyInfo& reason, Boolean markBackingFieldsOnlyIfPropertyMarked)
     at Mono.Linker.Steps.MarkStep.ApplyPreserveInfo(TypeDefinition type)
     at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
     at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
     at Mono.Linker.Steps.MarkStep.ProcessMarkedPending()
     at Mono.Linker.Steps.MarkStep.Initialize()
     at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
     at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
     at Mono.Linker.Pipeline.Process(LinkContext context)
     at Mono.Linker.Driver.Run(ILogger customLogger)
     at Mono.Linker.Driver.Main(String[] args)

Any ideas?

/cc @shushanhf

@kant2002
Copy link
Contributor Author

Most likely not importantn, but command line is following

/home/loongson/runtime/.dotnet/dotnet "/home/loongson/.nuget/packages/microsoft.net.illink.tasks/7.0.100-1.22552.1/tools/net7.0/illink.dll" -a "/home/loongson/runtime/artifacts/obj/coreclr/System.Private.CoreLib/loongarch64/Debug/PreTrim/System.Private.CoreLib.dll" library
                     -out "/home/loongson/runtime/artifacts/obj/coreclr/System.Private.CoreLib/loongarch64/Debug/"
                     --warnaserror-  --ignore-link-attributes true --skip-unresolved true --trim-mode skip --action skip --action link System.Private.CoreLib -b true -x "/home/loongson/runtime/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml" --nowarn IL2008;IL2009;IL2012;IL2025;IL2026;IL2035;IL2050;IL2032;IL2055;IL2057;IL2058;IL2059;IL2060;IL2061;IL2062;IL2063;IL2064;IL2065;IL2066;IL2067;IL2068;IL2069;IL2070;IL2071;IL2072;IL2073;IL2074;IL2075;IL2076;IL2077;IL2078;IL2079;IL2080;IL2081;IL2082;IL2083;IL2084;IL2085;IL2086;IL2087;IL2088;IL2089;IL2090;IL2091;IL2121

@vitek-karas
Copy link
Member

No immediate ideas - unfortunately the method BuildTypeAnnotations is rather large so it's hard to even guess where in the method the problem is.

Few questions:

  • Does it repro?
  • I assume (based on your description) this happens when trying to build running on the loongarch hardware, so it's going to be hard for me to repro it
  • I assume this happens during build of the runtime repo - could you share the command line? Which config and so on.

If it does repro, could you please gather a repro archive for us?

  • Clone https://github.com/vitek-karas/illinkrepro
  • Build it with an SDK (it's net7.0 now)
  • Run the runtime build to repro the problem with /bl to grab a binlog
  • Run the tool illinkrepro create msbuild.binlog
  • This will produce a directory repro - zip it and share if it's OK with you. Or you can send it to me via email (vitek.karas at microsoft com)

@kant2002
Copy link
Contributor Author

questions:

  • it repro consistently on Loongarch cloud instance
  • yes, that happens on Loongarch hardware. Technically maybe this is related to some obscure JIT bug(who knows)
  • Yes. I'm building runtime repo, almost pristine, except I disable building crossgen2 (probably unrelated)

illinkrepo produce issues

/home/loongson/illinkrepro/illinkrepro.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.linux-loongarch64. No packages exist with this id in source(s): nuget.org
/home/loongson/illinkrepro/illinkrepro.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Runtime.linux-loongarch64. No packages exist with this id in source(s): nuget.org

I do have .NET SDK in the ~/runtime/.dotnet/ folder, but seems to be I'm stuck with chicken/egg problem. That' probably question to runtime folks.

I copy DLL and XML files from the machine locally, and issue does not reproduced.

@vitek-karas
Copy link
Member

The repro tool by default builds as single-file - just disable that in the project file. It should build then (no need for runtime packs).

@kant2002
Copy link
Contributor Author

repro.tar.gz
Does not reproduced on win-x64 for me.

@kant2002
Copy link
Contributor Author

I did try to build this repo, and seems to be illink.dll is produced, but I have this error

/home/loongson/linker/eng/ilasm.ilproj : error NU1101: Unable to find package runtime.linux-loongarch64.microsoft.netcore.ilasm. No packages exist with this id in source(s): dotnet-eng, dotnet-public, dotnet-tools, dotnet6, dotnet7
/home/loongson/linker/eng/ilasm.ilproj : error NU1101: Unable to find package runtime.linux-loongarch64.microsoft.netcore.ildasm. No packages exist with this id in source(s): dotnet-eng, dotnet-public, dotnet-tools, dotnet6, dotnet7

Any ideas is this is important or not?

@kant2002
Copy link
Contributor Author

I run repro with following command on Loongarch hardware using illink.dll which is build there

~/runtime/.dotnet/dotnet /home/loongson/linker/artifacts/bin/Mono.Linker/Debug/net7.0/illink.dll @linker.rsp

and issue does not repro. any ideas?

@kant2002
Copy link
Contributor Author

Ooh, runtime use ancient version of illink 7.0.100-1.22552.1 which is from Preview 1, and seems to be you are fixing this after on latest bits. I did replace version on nuget cache with locally build version and issue is gone.
would be curious to know what commit fixes this issue. Do you know what should I do to bump version of microsoft.net.illink.tasks on the runtime repo?

@akoeplinger
Copy link
Member

akoeplinger commented Nov 23, 2022

The linker bump is currently in a PR in dotnet/runtime#78020.

We're also updating to the stable 7.0.100 sdk in dotnet/runtime#78034 separately (if I remember correctly the runtime build overrides the linker bits from the sdk)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants