Problem with gprof on OS X: [program] is not of the host architecture
gcc, gprof, macos
Solution
The series of events here is supposed to work as follows:
- Compile code with `-pg` option
- Link code with `-pg` option
- Run program
- Program generates `gmon.out` file
- Run `gprof`
The problem is that step 4 never happens. There's very little information out about this specific failure. The general consensus over the past few years seems to be that Apple would rather use shark instead, and they've been very lax about fixing bugs and such with `gprof`.
In short: Install Xcode, `man shark`
Problem
I'm having trouble running `gprof` on OS X. The file `test.c` is: ``` #include <stdio.h> int main() { printf("Hello, World!\n"); return 0; } ``` and my terminal looks like: ``` $ gcc -pg test.c $ gcc -pg -o test test.c $ ./test Hello, World! $ gprof test gprof: file: test is not of the host architecture ``` Edit: also, it doesn't generate the file `gmon.out`. What's going on here?