gpt4 book ai didi

macos - OS X上gprof的问题: [program] is not of the host architecture

转载 作者:行者123 更新时间:2023-12-03 07:33:03 26 4
gpt4 key购买 nike

我在OS X上运行gprof时遇到问题。test.c文件是:

#include <stdio.h>

int main() {
printf("Hello, World!\n");
return 0;
}

我的终端看起来像:
$ gcc -pg test.c
$ gcc -pg -o test test.c
$ ./test
Hello, World!
$ gprof test
gprof: file: test is not of the host architecture

编辑:而且,它不会生成文件 gmon.out

这里发生了什么?

最佳答案

这里的一系列事件应该按如下方式工作:

  • 使用-pg选项
  • 编译代码
  • 带有-pg选项的链接代码
  • 运行程序
  • 程序生成gmon.out文件
  • 运行gprof

  • 问题是步骤4永远不会发生。关于此特定故障的信息很少。过去几年的普遍共识似乎是苹果宁愿改用鲨鱼,而且他们对于用 gprof修复错误等问题一直很松懈。

    简而言之:安装Xcode, man shark

    关于macos - OS X上gprof的问题: [program] is not of the host architecture,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1101545/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com