appdynamics

AppDynamics Agent for MAUI symbol not found for architecture x86_64


I try to use the nuget AppDynamics.Agent.Maui version 2023.2.0 on my MAUI mobile application.

It works for Android.

It works for iOS on a physical device

It works for iOS on a simulator on a Mac with Intel processor

But it does not work for iOS on a simulator on a Mac with M1 chip.

I have the following build error on my M1 Mac when building for iOS Simulator :

clang++ exited with code 1:
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_ADEumAgentConfiguration", referenced from:
      objc-class-ref in registrar.o
  "_OBJC_CLASS_$_ADEumCrashReportSummary", referenced from:
      objc-class-ref in registrar.o
  "_OBJC_CLASS_$_ADEumHTTPRequestTracker", referenced from:
      objc-class-ref in registrar.o
  "_OBJC_CLASS_$_ADEumInstrumentation", referenced from:
      objc-class-ref in registrar.o
  "_OBJC_CLASS_$_ADEumServerCorrelationHeaders", referenced from:
      objc-class-ref in registrar.o
  "_OBJC_CLASS_$_ADEumSessionFrame", referenced from:
      objc-class-ref in registrar.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation) (MyApplication.MAUI)

I don't have access to the source code.

It seems it is a binding from native xcframework, and the architecture is missing.

Any way to handle that ?


Solution

  • Adding following lines in the csproj does the trick.

    <Project Sdk="Microsoft.NET.Sdk">
    
      ...
    
      <PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
        <MTouchExtraArgs>--registrar:static</MTouchExtraArgs>
      </PropertyGroup>
    
    </Project>
    

    Details : With Mac M1 and M2 chips, the simulator architecture is arm64. With Mac Intel chips, the simulator architecture is x86_64.

    Because of that difference, the ios native library has to be built for each architectures.

    If not, the error occurs, and the command MTouch argument --registrar:static works as a workaround.