调试ios命令行中的问题 - Xcode

时间:2012-05-24 14:10:58

标签: iphone ios xcode debugging xcodebuild

我为iPhone构建了一个项目,并在Xcode 4.3.2中进行调试。但是,我想在命令行中调试它,所以我运行:

xcodebuild -target NAMEOFTARGET -sdk SDKPATH -configuration Release

它应该和Xcode中的相同,但是我得到了一些错误而且它没有编译!也许有人可以帮忙...

-Prefix-cfqwmqlvdeltqcceqguoaugscmoq/Igor2305-Prefix.pch.d
error: can't exec '/opt/local/bin/gcc-apple-4.2' (No such file or directory)
Command /opt/local/bin/gcc-apple-4.2 failed with exit code 71
 ** BUILD FAILED **
The following build commands failed:
ProcessPCH /var/folders/d7/sx0vvl0537l4x7md9b35m7br0000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/Igor2305-Prefix-fwljjtsqayhghvfeivuxdyjuvt/Igor2305-Prefix.pch.pth Igor2305/Igor2305-Prefix.pch normal armv6 objective-c com.apple.compilers.llvm.clang.1_0.compiler
ProcessPCH /var/folders/d7/sx0vvl057l4x7md9b35m7br00gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/Igor2305-Prefi-cfqwmqlvdeltqceqguoaugscmoq/Igor2305-Prefix.pch.pth Igor2305/Igor2305-Prefix.pch normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)

1 个答案:

答案 0 :(得分:3)

它正在寻找/opt/中的GCC而未找到它。这不是与Xcode捆绑在一起的GCC的标准安装位置。以下命令将告诉您Xcode在哪里寻找其开发人员工具:

xcode-select -print-path

要更改它,请运行:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

该路径适用于通过App Store安装的标准Xcode安装位置。如果您已将其安装在其他位置,则必须相应地更改路径。