xcodebuild找不到gcc 4.2

时间:2022-09-24 21:32:51

I am trying to run xcodebuild and I am getting the following error:

我正在尝试运行xcodebuild,我收到以下错误:

2011-12-11 04:42:22.834 xcodebuild[9155:4203] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x objective-c -c /dev/null 2>&1" UserInfo=0x4001a61a0 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x objective-c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2011-12-11 04:42:22.835 xcodebuild[9155:4203] Warning:  Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'objective-c'.
Compiler: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2
Reason:   /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x objective-c -c /dev/null 2>&1
2011-12-11 04:42:22.895 xcodebuild[9155:4203] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x c -c /dev/null 2>&1" UserInfo=0x4013cbb80 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2011-12-11 04:42:22.900 xcodebuild[9155:4203] Warning:  Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c'.
Compiler: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2
Reason:   /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x c -c /dev/null 2>&1

Any idea why this is? I am guessing that it is because I don't have gcc-4.2 in the following path:

知道为什么会这样吗?我猜这是因为我在以下路径中没有gcc-4.2:

/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2

as of right now gcc-4.2 is located at usr/bin. The question is how do I redirect it?

截至目前,gcc-4.2位于usr / bin。问题是我该如何重定向?

3 个解决方案

#1


1  

This could be be related to your $CC variable in your shell ( it keeps track of your compiler ) you can find more information from jMoody on github

这可能与你的shell中的$ CC变量有关(它跟踪你的编译器)你可以在github上找到jMoody的更多信息

Essentially you need to remove $CC

基本上你需要删除$ CC

#2


0  

How did you select the compiler? Go to the Xcode navigator, click on the upmost item, then in the right window on your project (not the target), then Build Settings. U and in the section Build Options you can select the compiler. Usually you can choose between LLVM gcc-4.x and some Apple LLVM x.

你是如何选择编译器的?转到Xcode导航器,单击最上面的项目,然后单击项目右侧窗口(而不是目标),然后单击Build Settings。您可以在构建选项部分中选择编译器。通常,您可以在LLVM gcc-4.x和某些Apple LLVM x之间进行选择。

#3


0  

Have you used xcode-select to select the version of Xcode you want to use?

您是否使用xcode-select选择要使用的Xcode版本?

Manpage.

#1


1  

This could be be related to your $CC variable in your shell ( it keeps track of your compiler ) you can find more information from jMoody on github

这可能与你的shell中的$ CC变量有关(它跟踪你的编译器)你可以在github上找到jMoody的更多信息

Essentially you need to remove $CC

基本上你需要删除$ CC

#2


0  

How did you select the compiler? Go to the Xcode navigator, click on the upmost item, then in the right window on your project (not the target), then Build Settings. U and in the section Build Options you can select the compiler. Usually you can choose between LLVM gcc-4.x and some Apple LLVM x.

你是如何选择编译器的?转到Xcode导航器,单击最上面的项目,然后单击项目右侧窗口(而不是目标),然后单击Build Settings。您可以在构建选项部分中选择编译器。通常,您可以在LLVM gcc-4.x和某些Apple LLVM x之间进行选择。

#3


0  

Have you used xcode-select to select the version of Xcode you want to use?

您是否使用xcode-select选择要使用的Xcode版本?

Manpage.