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

Revert "Enable symbol stripping for crossgen2" #82881

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

am11
Copy link
Member

@am11 am11 commented Mar 2, 2023

Causing intermittent failures on macOS.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Mar 2, 2023
@jkotas
Copy link
Member

jkotas commented Mar 3, 2023

Any links to log or issues tracking these intermittent failures?

@am11
Copy link
Member Author

am11 commented Mar 3, 2023

I'm on Xcode 14.2. dsymutil call failed for me about 3 out of 10 times today with:
rm -rf artifacts; ./build.sh clr+libs+packs

These are the warnings (treated as errors) show up and fail the build (that EXEC task is the one which invokes dsymutil):

  crossgen2 -> /Users/am11/projects/runtime/artifacts/bin/coreclr/osx.arm64.Debug/crossgen2/crossgen2.dll
  Generating native code
EXEC : error : (arm64)  could not find object file symbol for symbol __Z19InitializeCpuCGroupv [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup10InitializeEv [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __Z16CleanupCpuCGroupv [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup7CleanupEv [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __Z11GetCpuLimitPj [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup11GetCpuLimitEPj [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup17FindCGroupVersionEv [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup14FindCGroupPathEPFbPKcE [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup21IsCGroup1CpuSubsystemEPKc [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup18FindHierarchyMountEPFbPKcEPPcS5_ [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup26FindCGroupPathForSubsystemEPFbPKcE [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup18GetCGroup1CpuLimitEPj [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup18GetCGroup2CpuLimitEPj [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup18ReadCpuCGroupValueEPKc [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup15ComputeCpuLimitExxPj [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZN6CGroup25ReadLongLongValueFromFileEPKcPx [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZL16s_cgroup_version [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
EXEC : error : (arm64)  could not find object file symbol for symbol __ZL17s_cpu_cgroup_path [/Users/am11/projects/runtime/src/coreclr/tools/aot/crossgen2/crossgen2.csproj]
  crossgen2 -> /Users/am11/projects/runtime/artifacts/bin/coreclr/osx.arm64.Debug/crossgen2/osx-arm64/publish/
  Emitting R2R PE file: /Users/am11/projects/runtime/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Debug/net8.0/osx-arm64/S.P.C.tmp
  /Users/am11/projects/runtime/artifacts/obj/Microsoft.NETCore.App.Crossgen2/Debug/net8.0/osx-arm64/output/ -> /Users/am11/projects/runtime/artifacts/packages/Debug/Shipping//dotnet-crossgen2-8.0.0-dev-osx-arm64.tar.gz
  Successfully created package '/Users/am11/projects/runtime/artifacts/packages/Debug/Shipping/Microsoft.NETCore.App.Crossgen2.osx-arm64.8.0.0-dev.nupkg'.
  Successfully created package '/Users/am11/projects/runtime/artifacts/packages/Debug/Shipping/Microsoft.NETCore.App.Crossgen2.osx-arm64.8.0.0-dev.symbols.nupkg'.
...
Build failed with exit code 1. Check errors above.

It is about static libs (.a files) sometimes not keeping all the symbols which the final linkage needs. I think the main issue with these cgroup symbols is that they are not exported in our code, and we rely on weak assumption that linker will do the right thing here.

So far I have found few options to resolve these flaky "could not find object file symbol for symbol" errors:

  1. explicitly export these symbols so they are always kept.
  2. resort to this Xcode setting: https://developer.apple.com/documentation/xcode/build-settings-reference#Perform-Single-Object-Prelink but simulating it without Xcode (raw clang and dsymutil commands as we have) is bit involved; it requires some ld64 invocation and few other commands, I haven't figured out the right sequence yet.
  3. perhaps a more straight-forward way is that we ship object files .o instead of static libs (.a). The linkage of .o is straightforward and it avoids complexities of static libs.

Sooner rather than later, people building runtime locally on M1 machines will start noticing this so I thought it's better to just revert it and continue investigating possible solutions in the background.

@jkotas
Copy link
Member

jkotas commented Mar 3, 2023

Ok, thanks for being on top of these issues.

@jkotas jkotas merged commit 13853e5 into dotnet:main Mar 3, 2023
am11 added a commit to am11/runtime that referenced this pull request Mar 7, 2023
jkotas pushed a commit that referenced this pull request Mar 8, 2023
* Revert "Revert "Enable symbol stripping for crossgen2 (#82698)" (#82881)"

This reverts commit 13853e5.

* Rename cgroup.cpp to cgroupcpu.cpp
@ghost ghost locked as resolved and limited conversation to collaborators Apr 2, 2023
@am11 am11 deleted the revert-82698-patch-14 branch June 14, 2024 04:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Setup community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants