Troubleshooting Debug on OSX ARM64
Starting with apple M1, all mac OSes run on ARM64. Existing x64 programs can still work on it thanks to rosetta, and indeed published versions of PMDO for oxs-x64 work just fine.
However, building and debugging PMDO becomes confusing, as the build toolchain and the IDE may try to use the arm64 version instead of x64. It may build the arm64 version, or debug an x64 build as if it were arm64. Additionally, arm64 libraries are missing and thus cannot be run (at least not without building every dependency for arm64).
This page goes over the troubleshooting process for getting PMDO to debug on OSX-ARM64. It is currently unresolved.
VS Code
Rider
Sanity Checks
These steps were taken to ensure the setup was correct.
Other Projects
Attempting to debug on other projects using Rider worked.
Clearing Rider Cache
File -> Invalidate Cache -> Choose all
This did not resolve the issue.
Clearing Nuget Cache
Delete ~/.nuget
to remove all nuget packages so that they'll be redownloaded cleanly on next build.
It deletes gigabytes of data. Build works and regenerated them cleanly.
This did not resolve the issue.
Clean Clone from Repository
We are trying the basic Example program that contains the bare minimum in dependencies.
Do a fresh clone+submodules of RogueEssence in this branch: https://github.com/RogueCollab/RogueEssence/tree/Example
This did not resolve the issue, but this provides a good base to start isolating the problem in.
Factors to Consider
DotNet installations: Do we have more than one NetCore installation?
A:
We have two runtimes of dotnet: /usr/local/share/dotnet/x64/dotnet
and /usr/local/share/dotnet/dotnet
. Which runtime do we use in Rider?
A:
What are the possible configurations when building/debugging?
A:
Configuration Attempts and Their Results
A series of experiments were performed in running the command line dotnet build
and running the outputted executable. Before each experiment, the bin/ and obj/ subfolders were completely deleted.
These are the results you get when you perform the following actions with a wiped bin/obj:
- dotnet build: Fails. It builds out to bin/Debug/net8.0. Complains about libskia.dylib and requires it to be arm64. Ran using ./PMDC
- dotnet build -c Debug -r osx-x64: Successful. It builds out to bin/Debug/net8.0/osx-x64 but does not copy fnalibs. Once done manually, running ./PMDC -dev -asset ../../../../../DumpAsset/ succeeds.
- Debugging in Rider with PMDC configured to Any CPU: Exact same result as dotnet build.
- Debugging in Rider with PMDC configured to x64: Fails. It builds out to bin/Debug/net8.0. Complains with System.IO.FileLoadException: Could not load file or assembly 'PMDC'. This error also shows up if ran using ./PMDC
Backup Plans
- Plan A was to clear all the caches and ensure no remnant dependencies...
- Plan B was to look into configuration to see if anything could be set right there.
- Plan C will be an attempt to attach a debugger to the x64 build that does work, and come up with some patch solution on that.
- Plan D is to do it all the hard way and build PMDO with arm64 skiasharp off an example avalonia project plus Xcode building fnalibs plus additional building for lualibs and core.so