iOS Simulator unable to load the application - Rosetta error

I have a project running on Xcode 13.2.1 (M1 Pro Macbook - running under Rosetta) and after build and run the application, when simulator launches the app I get this error and the app crashes:

rosetta error: /Users/MyNamed/Library/Developer/CoreSimulator/Devices/1BD3D129-CA10-43C9-AEFF-F0432D47365A/data/Containers/Bundle/Application/CAED47CA-E288-4681-9771-88E2ECE34321/MyApp.app/MyApp: load commands too large error: attach by pid '93801' failed -- lost connection

Full report below:

Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: 67A2A1BD-4B41-4D2A-8A1B-854A5B217346
CrashReporter Key:   D55AE94A-30DB-57BB-6735-CCA816367BE0
Hardware Model:      MacBookPro18,1
Process:             MyApp [93801]
Path:                /Users/USER/Library/Developer/CoreSimulator/Devices/1BD3D129-CA10-43C9-AEFF-F0432D47365A/data/Containers/Bundle/Application/CAED47CA-E288-4681-9771-88E2ECE34321/MyApp.app/MyApp
Identifier:          com.id.iphone
Version:             226 (1)
Code Type:           X86-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [83891]
Coalition:           com.apple.CoreSimulator.SimDevice.1BD3D129-CA10-43C9-AEFF-F0432D47365A [8513]
Responsible Process: SimulatorTrampoline [735]

Date/Time:           2022-04-28 11:21:32.1672 +0100
Launch Time:         2022-04-28 11:21:27.9880 +0100
OS Version:          macOS 12.0.1 (21A559)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00007ff7ffd34af8
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [93801]

Highlighted by Thread:  0

Backtrace not available

No thread state (register information) available

Binary Images:
Binary images description not available

Error Formulating Crash Report:
_dyld_process_info_create failed with 6
dyld_process_snapshot_get_shared_cache failed
Failed to create CSSymbolicatorRef - corpse still valid ¯\_(ツ)_/¯

EOF

-----------
Full Report
-----------

{"app_name":"MyApp","timestamp":"2022-04-28 11:21:34.00 +0100","app_version":"226","slice_uuid":"5e179e1a-0c44-3168-abd4-8598cec7dc86","build_version":"1","platform":0,"bundleID":"com.myapp.iphone","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.0.1 (21A559)","incident_id":"67A2A1BD-4B41-4D2A-8A1B-854A5B217346","name":"MyApp"}
{
  "uptime" : 39000,
  "procLaunch" : "2022-04-28 11:21:27.9880 +0100",
  "procRole" : "Foreground",
  "version" : 2,
  "userID" : 504,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro18,1",
  "procStartAbsTime" : 948785111065,
  "coalitionID" : 8513,
  "osVersion" : {
    "train" : "macOS 12.0.1",
    "build" : "21A559",
    "releaseType" : "User"
  },
  "captureTime" : "2022-04-28 11:21:32.1672 +0100",
  "incident" : "67A2A1BD-4B41-4D2A-8A1B-854A5B217346",
  "bug_type" : "309",
  "pid" : 93801,
  "procExitAbsTime" : 948883872901,
  "translated" : true,
  "cpuType" : "X86-64",
  "procName" : "MyApp",
  "procPath" : "\/Users\/USER\/Library\/Developer\/CoreSimulator\/Devices\/1BD3D129-CA10-43C9-AEFF-F0432D47365A\/data\/Containers\/Bundle\/Application\/CAED47CA-E288-4681-9771-88E2ECE34321\/MyApp.app\/MyApp",
  "bundleInfo" : {"CFBundleShortVersionString":"989898","CFBundleVersion":"1","CFBundleIdentifier":"com.id.iphone"},
  "storeInfo" : {"deviceIdentifierForVendor":"B8806C7A-2774-56E4-8E50-41D4A8C204B1","thirdParty":true},
  "parentProc" : "launchd_sim",
  "parentPid" : 83891,
  "coalitionName" : "com.apple.CoreSimulator.SimDevice.1BD3D129-CA10-43C9-AEFF-F0432D47365A",
  "crashReporterKey" : "D55AE94A-30DB-57BB-6735-CCA816367BE0",
  "responsiblePid" : 735,
  "responsibleProc" : "SimulatorTrampoline",
  "wakeTime" : 11496,
  "sleepWakeUUID" : "B6C14C1A-FE43-4E98-AF85-5D6C7BD6F889",
  "sip" : "enabled",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000001, 0x00007ff7ffd34af8","rawCodes":[1,140703125687032],"type":"EXC_BREAKPOINT","signal":"SIGTRAP"},
  "termination" : {"flags":0,"code":5,"namespace":"SIGNAL","indicator":"Trace\/BPT trap: 5","byProc":"exc handler","byPid":93801},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":1,"thread_set_state":0,"task_for_pid":64},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":2},"warnings":0},
  "legacyInfo" : {
  "threadHighlighted" : 0
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "601d9415f79519000ccd4b69",
      "factorPackIds" : {
        "SIRI_TEXT_TO_SPEECH" : "61ef3bd729647d394933a0a6"
      },
      "deploymentId" : 240000416
    },
    {
      "rolloutId" : "60356660bbe37970735c5624",
      "factorPackIds" : {

      },
      "deploymentId" : 240000027
    },
    {
      "rolloutId" : "602ad4dac86151000cf27e46",
      "factorPackIds" : {
        "SIRI_DICTATION_ASSETS" : "61ae8d06da72d16a4beb762e"
      },
      "deploymentId" : 240000305
    },
    {
      "rolloutId" : "60da5e84ab0ca017dace9abf",
      "factorPackIds" : {

      },
      "deploymentId" : 240000008
    },
    {
      "rolloutId" : "607844aa04477260f58a8077",
      "factorPackIds" : {
        "SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
      },
      "deploymentId" : 240000066
    },
    {
      "rolloutId" : "5fb4245a1bbfe8005e33a1e1",
      "factorPackIds" : {

      },
      "deploymentId" : 240000015
    },
    {
      "rolloutId" : "5ffde50ce2aacd000d47a95f",
      "factorPackIds" : {

      },
      "deploymentId" : 240000136
    },
    {
      "rolloutId" : "5fc94383418129005b4e9ae0",
      "factorPackIds" : {

      },
      "deploymentId" : 240000349
    }
  ],
  "experiments" : [

  ]
},
  "reportNotes" : [
  "_dyld_process_info_create failed with 6",
  "dyld_process_snapshot_get_shared_cache failed",
  "Failed to create CSSymbolicatorRef - corpse still valid ¯\\_(ツ)_\/¯"
]
}

Model: MacBookPro18,1, BootROM 7429.41.5, proc 10:8:2 processors, 16 GB, SMC 
Graphics: Apple M1 Pro, Apple M1 Pro, Built-In
Display: Color LCD, 3456 x 2234 Retina, Main, MirrorOff, Online
Memory Module: LPDDR5
AirPort: Wi-Fi, wl0: Sep 24 2021 15:49:44 version 20.10.853.23.8.7.106 FWID 01-78e271b2
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: USB3.0 Hub
USB Device: USB2.0 Hub
USB Device: USB-C Digital AV Multiport Adapter
USB Device: USB31Bus
USB Device: USB31Bus
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc.

This is happening on a M1 Pro machine for me and all my coworkers with M1 Macs.

Anyone have an idea what it could be?

Answered by grigorye in 714624022

Move your DerivedData to a path that is short enough. E.g. to /tmp. That was a solution that worked for us/seems to be related to paths hard-coded in LC_PATH load commands or something like that (take a look at otool -l <your mach_o executable> output).

Accepted Answer

Move your DerivedData to a path that is short enough. E.g. to /tmp. That was a solution that worked for us/seems to be related to paths hard-coded in LC_PATH load commands or something like that (take a look at otool -l <your mach_o executable> output).

iOS Simulator unable to load the application - Rosetta error
 
 
Q