Troubleshooting Debug on OSX ARM64: Difference between revisions

From PMDOWiki
IDK (talk | contribs)
Rider debugging
IDK (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
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).
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.
This page goes over the troubleshooting process for getting PMDO to debug on OSX-ARM64 using Rider.  It is currently unresolved.


= VS Code =


 
== Sanity Checks ==
 
 
== Rider ==
 
=== Sanity Checks ===


These steps were taken to ensure the setup was correct.
These steps were taken to ensure the setup was correct.


==== Other Projects ====
=== Other Projects ===


Attempting to debug on other projects using Rider worked.
Attempting to debug on other projects using Rider worked.


==== Clearing Rider Cache ====
=== Clearing Rider Cache ===


File -> Invalidate Cache -> Choose all
File -> Invalidate Cache -> Choose all
Line 26: Line 20:
This did not resolve the issue.
This did not resolve the issue.


==== Clearing Nuget Cache ====
=== Clearing Nuget Cache ===


Delete <code>~/.nuget</code> to remove all nuget packages so that they'll be redownloaded cleanly on next build.
Delete <code>~/.nuget</code> to remove all nuget packages so that they'll be redownloaded cleanly on next build.
Line 34: Line 28:
This did not resolve the issue.
This did not resolve the issue.


==== Clean Clone from Repository ====
=== Clean Clone from Repository ===


We are trying the basic Example program that contains the bare minimum in dependencies.
We are trying the basic Example program that contains the bare minimum in dependencies.
Line 44: Line 38:


=== Factors to Consider ===
=== Factors to Consider ===
DotNet installations: Do we have more than one NetCore installation?
A:


We have two runtimes of dotnet: <code>/usr/local/share/dotnet/x64/dotnet</code> and <code>/usr/local/share/dotnet/dotnet</code>. Which runtime do we use in Rider?
We have two runtimes of dotnet: <code>/usr/local/share/dotnet/x64/dotnet</code> and <code>/usr/local/share/dotnet/dotnet</code>. Which runtime do we use in Rider?
A:


What are the possible configurations when building/debugging?
What are the possible configurations when building/debugging?
A:




Line 66: Line 50:
These are the results you get when you perform the following actions with a wiped bin/obj:
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:  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.
* dotnet build -c Debug -r osx-x64: Successful.  It builds out to bin/Debug/net8.0/osx-x64 but does not copy fnalibs.  Once they are copied 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 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
* 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
Line 76: Line 60:
* Plan B was to look into configuration to see if anything could be set right there.
* 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 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
* Plan D is to do it all the hard way and build PMDO with arm64 skiasharp off an example avalonia project plus [[Upgrading_FNA_Dependencies|Xcode building fnalibs]] plus additional building for [[Upgrading_Lua_Debug|lualibs and core.so]]






[[Category: Troubleshooting]]
[[Category: Troubleshooting]]

Latest revision as of 19:38, 11 November 2024

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 using Rider. It is currently unresolved.


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

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?

What are the possible configurations when building/debugging?


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 they are copied 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