cmyr / cargo-instruments

A cargo plugin to generate Xcode Instruments trace files
MIT License
681 stars 34 forks source link

Unknown error related to Rosetta translation #52

Open hungkhoaitay opened 3 years ago

hungkhoaitay commented 3 years ago
hungkhoaitay@Hungs-MacBook-Air in-summer-we-render % cargo instruments -t time --release --bin ply_to_png -- -i $plySource/binary_longdress/longdress_vox10_1223.ply -x 600 -w 400 -h 800 -o ouput.png
   Compiling in-summer-we-render v0.1.0 (/Users/hungkhoaitay/Documents/Uni/Summer Y1/CP3108B/in-summer-we-render)
    Finished release [optimized + debuginfo] target(s) in 3.32s
   Profiling target/release/ply_to_png with template 'Time Profiler'
2021-10-10 22:21:11.467991+0800 ply_to_png[79442:7334462] +[MTLIOAccelDevice registerDevices]: Zero Metal services found
Image saved to "ouput.png"
      Failed instruments errored: [ERROR] Run issues detected (trace is still ready to be viewed):
* Failed to pause recording session: Cannot pause session session unless it's running. Current state: kSessionError 

* Failed to start the recording: ktrace cannot trace the system under Rosetta translation

* No configuration information received, will have to guess.  Data may be misleading.

* Data stream: Time Mapping

* Failed to resume recording session: Cannot resume session session unless it's paused. Current state: kSessionError 

Thank you

cmyr commented 3 years ago

It looks like you might have Xcode running via rosetta? Are you running a recent version?

cmyr commented 3 years ago

related to your other issue, you want brew config to say Rosetta 2: false at the bottom.

ruseinov commented 1 year ago

I've been facing a similar error, wasn't able to fix it though yet as it seems easier to run xctrace manually than dealing with this.

To give some context: cargo instruments is using open utility to run xctrace. And the open binary on my machine has two architectures listed:

$ file `which open`
/usr/bin/open: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/open (for architecture x86_64):    Mach-O 64-bit executable x86_64
/usr/bin/open (for architecture arm64e):    Mach-O 64-bit executable arm64e

What this means is, since arch is arm64 - this would automatically run in compatibility mode. I'm pretty sure this is the culprit, as otherwise this is running fine.

cmyr commented 1 year ago

I see the same thing from the command line, but cargo instruments works as expected, for me. :(

dukeeagle commented 1 year ago

I'm facing this exact same issue on my M2 machine! Did you resolve this @ruseinov?

ruseinov commented 1 year ago

I'm facing this exact same issue on my M2 machine! Did you resolve this @ruseinov?

To be honest I didn't bother. I don't remember exactly, but I think I ended up using xctrace manually. The fix should probably entail using xctrace directly as opposed to doing it through open.