Using CLion to profile a x86_64 program on Apple Silicon 关注
I use CLion for developing a C++ program on an Apple Silicon MacBook (M1 MAX CPU more specifically). This program is built with CMake and targeting x86_64 architecture, and I set `CMAKE_OSX_ARCHITECTURES` to `x86_64` so that CLion can compile and debug the project correctly. However, when I use the "Profile` button to profile my program, CLion reported error like "Cannot attach the profiler. Make sure that source application is built for target architecture."
I am not sure how I can use profiler to profile my application in this case. Could anyone shed some light on this? Thanks.
My setup:
1) M1 MAX CPU
2) macOS 13.0.1
3) Apple Clang 14.0.0
4) CLion 2022.3 release candidate Apple Silicon version (I tried CLion 2022.2.4 Intel version as well, reporting the same error)
请先登录再写评论。
Hello!
On Apple silicon machines, DTrace's default protection level allows profiling arm64 applications only. Please see the prerequisites for macOS here - https://www.jetbrains.com/help/clion/cpu-profiler.html#Prerequisites
So it is not possible to profile a x86_64 program on Apple Silicon machine, correct?
Correct. It's possible to profile arm64 applications only.
Got it. Thanks for the prompt reply.