无法在 Xcode 4 中编译 plcrashreporter
在为设备进行编译时,我可以使用 plcrashreporter 项目页面上提供的预构建框架,但不能用于模拟器。我有同样的此处描述的问题。
我假设预构建的框架不支持模拟器的体系结构,因此我下载了 plcrashreporter 源代码。我打开 Xcode 项目并选择 CrashReporter-iOS-Simulator > iPhone 4.3 模拟器
目标。当我尝试构建项目时,我收到此错误:
libtool: unknown option character `D' in: -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000
当我尝试构建大多数其他目标(例如设备)时,我收到相同的错误。
我的下一步是尝试将源文件添加到我的项目中。我不再有上述问题;但是,当我尝试编译时,出现此错误:
fatal error: 'crash_report.pb-c.h' file not found [2] #import "crash_report.pb-c.h" ^ 1 error generated. Command clang failed with exit code 1
错误消息中提到的 crash_report.pb-ch
文件根本不存在;我搜索了 plcrashreporter 源代码树和互联网。因此,我必须假设这个文件应该以某种方式生成,但我不知道如何生成。
(注释掉 PLCrashReport.m 中包含 crash_report.pb-ch
的行会导致许多其他编译错误。)
I can use the prebuilt framework provided on the plcrashreporter project page when compiling for the device, but not for the simulator. I have the same problem described here.
I assume the prebuilt framework does not support the simulator's architecture, so I downloaded out the plcrashreporter source. I opened the Xcode project and selected the CrashReporter-iOS-Simulator > iPhone 4.3 Simulator
target. When I try to build the project, I get this error:
libtool: unknown option character `D' in: -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000
I get the same error when I try to build most of the other targets (such as for device).
My next step was to try adding the source files to my project. I no longer have the aforementioned problem; however, I get this error when I try to compile:
fatal error: 'crash_report.pb-c.h' file not found [2] #import "crash_report.pb-c.h" ^ 1 error generated. Command clang failed with exit code 1
The crash_report.pb-c.h
file which is mentioned in the error message simply does not exist; I've searched the plcrashreporter source tree and the internet. Therefore, I have to assume that this file is supposed to be generated somehow, but I cannot figure out how.
(Commenting out the line in PLCrashReport.m on which crash_report.pb-c.h
is included results in numerous other compilation errors.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是正确的,因为该文件通常不存在,也不存在
crash_report.pb-cc
,这将是您在此错误之后的下一个错误。crash_report.pb.h
和crash_report.pb.c
文件是在编译时通过构建规则生成的。您需要将自定义脚本添加到构建过程中才能制作它们。首先,确保项目的 plcrashreporter 文件夹中有 protoc-c (
plcrashreporter-1.0/Dependencies/protobuf-2.0.3/bin/protoc-c
)。他们把它埋得很深。这就是您的脚本将运行的内容。然后找到您的
crash_report.proto
文件。这是protoc-c
将用于创建丢失文件的主要输入。您可以获取此目录并将其手动放入脚本中,或者您可以制定规则以在每个*.proto
文件上运行脚本。我做后者。然后编辑您的构建规则以包含运行带有标记
--c_out="${DERIVED_FILES_DIR}"
的protoc-c
的脚本和您的crash_report.proto< /code> 文件作为两个输入,这会将
crash_report.pb-ch
和crash_report.pb-cc
输出到与您所在目录相同的目录中crash_report.proto 文件是,它应该已经可以在您的项目中访问。Xcode 4(及更高版本)中的构建规则位于项目目标的构建规则选项卡下。您可以在所有其他构建规则之前添加一个构建规则。这是我的在 Xcode 中的样子:
您可能需要摆弄该目录
You are correct in that the file does not exist normally, nor does
crash_report.pb-c.c
exist, which will be your next error after this one.The
crash_report.pb.h
andcrash_report.pb.c
files are generated at compile time through a build rule. You need to add a custom script to your build process to make them.First, make sure you have protoc-c in the plcrashreporter folder of your project (
plcrashreporter-1.0/Dependencies/protobuf-2.0.3/bin/protoc-c
). They buried it deep. This is what your script will be running.Then find your
crash_report.proto
file. This is the main input thatprotoc-c
will be using to create your missing files. You can take this directory and put it manually into your script, OR you can make a rule to run the script on every*.proto
file. I do the latter.Then edit your build rules to include a script that runs
protoc-c
with the flag--c_out="${DERIVED_FILES_DIR}"
and yourcrash_report.proto
file as two inputs, this will outputcrash_report.pb-c.h
andcrash_report.pb-c.c
into the same directory as where your crash_report.proto file is, which should already be accessible in your project.The build rules in Xcode 4 (and above) are under your project's target's build rules tab. You add a build rule before all your other build rules. Here's what mine looks like in Xcode:
You'll probably have to fiddle with the directory