在Xcode6.3中使用Carthage安装Alamofire和SwiftyJSON

4
我很想使用Carthage来安装Alamofire和SwiftJSON,但我无法使其正常工作。每次构建都失败了。
这是我的Cartfile(指向适用于Xcode 6.3的正确分支):
github "Alamofire/Alamofire" "xcode-6.3"
github "SwiftyJSON/SwiftyJSON" "xcode6.3"

Alamofire构建失败并出现如下错误:

error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /ur/bin/gcc-4.2 -v -E -dM -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -x c -c /dev/null 2>&1" UserInfo=0x7fbfb9e4d5d0 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /ur/bin/gcc-4.2 -v -E -dM -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -x c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2015-02-18 23:15:51.859 xcodebuild[53900:6388252] Warning:  Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c'.
Compiler: /ur/bin/gcc-4.2
Reason:   /ur/bin/gcc-4.2 -v -E -dM -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -x c -c /dev/null 2>&1
2015-02-18 23:15:51.865 xcodebuild[53900:6388253] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /ur/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -x c -c /dev/null 2>&1" UserInfo=0x7fbfbbb474d0 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /ur/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -x c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2015-02-18 23:15:51.865 xcodebuild[53900:6388253] Warning:  Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c'.
Compiler: /ur/bin/gcc-4.2
Reason:   /ur/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -x c -c /dev/null 2>&1
2015-02-18 23:15:52.448 xcodebuild[53900:6388249]  DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-6269/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/SpecificationTypes/BuiltInSpecifications/Compilers/XCGccMakefileDependencies.m:77
Details:  Failed to load dependencies output contents from ``/Users/devonboyer/Library/Developer/Xcode/DerivedData/Alamofire-gpmlmgkqhnaqwsdibrprtyuyoqpu/Build/Intermediates/Alamofire.build/Release-iphonesimulator/Alamofire iOS.build/Objects-normal/x86_64/Alamofire.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “Alamofire.d” couldn’t be opened because there is no such file." UserInfo=0x7fbfb9e774f0 {NSFilePath=/Users/devonboyer/Library/Developer/Xcode/DerivedData/Alamofire-gpmlmgkqhnaqwsdibrprtyuyoqpu/Build/Intermediates/Alamofire.build/Release-iphonesimulator/Alamofire iOS.build/Objects-normal/x86_64/Alamofire.d, NSUnderlyingError=0x7fbfb9e71f00 "The operation couldn’t be completed. No such file or directory"}. User info: {
    NSFilePath = "/Users/devonboyer/Library/Developer/Xcode/DerivedData/Alamofire-gpmlmgkqhnaqwsdibrprtyuyoqpu/Build/Intermediates/Alamofire.build/Release-iphonesimulator/Alamofire iOS.build/Objects-normal/x86_64/Alamofire.d";
    NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, void (^__strong)(NSString *__strong))
Thread:   <NSThread: 0x7fbfb9e1a3a0>{number = 7, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **


The following build commands failed:
    CompileSwift normal x86_64 /Users/devonboyer/Desktop/Reach/Reach/Carthage/Checkouts/Alamofire/Source/Alamofire.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

使用SwiftyJSON时出现以下错误:

Scheme SwiftyJSONOSX is not currently configured for the build action.

我很想弄清楚为什么这不起作用,因为我认为Carthage可能非常棒。请注意,除了按照Cartage git repo上的说明进行操作之外,我什么也没有做。只是运行了cartage update,就发生了这种情况。有任何想法吗?
xcode-select路径正确地指向Xcode的beta版本。
/Applications/Xcode-Beta.app/Contents/Developer

你是否使用了 xcode-select 命令来选择 Xcode 的测试版进行命令行构建? - Justin Spahr-Summers
我还没有,我该怎么做呢?也许这就是问题所在...顺便感谢您的回复! - DBoyer
你是否已经运行过 brew update - Allen
是的,我确保在尝试其他任何操作之前安装了最新版本的Carthage。 - DBoyer
SwiftyJSON主分支不支持Swift 1.2版本。 - Rog
显示剩余2条评论
1个回答

0

我决定暂时绕过Carthage来构建SwiftyJSON。 我采取了以下步骤(看起来比实际复杂)

1.) 从github克隆SwiftyJSON

2.) 切换到xcode6.3分支

3.) 在Xcode 6.3中打开SwiftyJSOn(现在是非beta版本)

4.) 删除调试配置(强制构建发布配置)

5.) 选择SwiftyJSON项目并打开右侧边栏,将“项目格式”更改为Xcode 6.3兼容

enter image description here

6.) 构建项目

7.) 打开 DerivedData 并导航到找到 SwiftyJSON.framework 为止

8.) 将 SwiftyJSON.framework 移动到 $(SRC_ROOT)/Carthage/Build/iOS/ 中

9.) 现在您的项目应该能够找到 SwiftyJSON 了

祝你好运,神速前进


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接