我正在尝试使用Jenkins CI(在带有Mavericks的Mac Mini上)使用该xcodebuild
命令来构建我的iOS项目.我玩了好几个小时,但是无法理解这个问题.
以下命令在命令行上构建我的项目没有任何问题,但在Jenkins中运行时失败.
xcodebuild -workspace ./MyProject.xcworkspace -scheme MyProject -configuration AdHoc -sdk iphoneos DSTROOT=/Users/me/myproject OBJROOT=/Users/me/myproject SYMROOT=/Users/me/myproject ONLY_ACTIVE_ARCH=NO OTHER_CODE_SIGN_FLAGS="--keychain /Users/me/Library/Keychains/temporary.keychain"
(为了清晰起见,添加了换行符.)
错误总是看起来像这样:
CompileC /Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/Objects-normal/armv7/SomeViewController.o MyProject/Code/Controllers/Event/SomeViewController.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler cd /Users/me/.jenkins/jobs/myproject/workspace export LANG=en_US.US-ASCII export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DCOCOAPODS=1 -DNS_BLOCK_ASSERTIONS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion -miphoneos-version-min=7.0 -iquote /Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/MyProject-generated-files.hmap -I/Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/MyProject-own-target-headers.hmap -I/Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/MyProject-all-target-headers.hmap -iquote /Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/MyProject-project-headers.hmap -I/Users/me/myproject/AdHoc-iphoneos/include -I/Users/me/.jenkins/jobs/myproject/workspace/Pods/Headers -I/Users/me/.jenkins/jobs/myproject/workspace/Pods/Headers/AFNetworking -I/Users/me/.jenkins/jobs/myproject/workspace/Pods/Headers/SDWebImage -I/Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/DerivedSources/armv7 -I/Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/DerivedSources -F/Users/me/myproject/AdHoc-iphoneos -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -isystem/Users/me/.jenkins/jobs/myproject/workspace/Pods/Headers -isystem/Users/me/.jenkins/jobs/myproject/workspace/Pods/Headers/AFNetworking -isystem/Users/me/.jenkins/jobs/myproject/workspace/Pods/Headers/SDWebImage -include /Users/me/Library/Developer/Xcode/DerivedData/MyProject-gyrrispdpuygvudbmupzhfzzaaag/Build/Intermediates/PrecompiledHeaders/MyProject-Prefix-asaxoaokmbdwezcdrhupsyxzhzrl/MyProject-Prefix.pch -MMD -MT dependencies -MF /Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/Objects-normal/armv7/SomeViewController.d --serialize-diagnostics /Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/Objects-normal/armv7/SomeViewController.dia -c /Users/me/.jenkins/jobs/myproject/workspace/MyProject/Code/Controllers/Event/SomeViewController.m -o /Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/Objects-normal/armv7/SomeViewController.o In file included from /Users/me/.jenkins/jobs/myproject/workspace/MyProject/Code/Controllers/Event/SomeViewController.m:9: In file included from /Users/me/.jenkins/jobs/myproject/workspace/MyProject/Code/Controllers/Event/SomeViewController.h:10: /Users/me/.jenkins/jobs/myproject/workspace/Pods/Headers/SDWebImage/UIImageView+WebCache.h:1:1: error: expected identifier or '(' ../../SDWebImage/SDWebImage/UIImageView+WebCache.h ^ In file included from /Users/me/.jenkins/jobs/myproject/workspace/MyProject/Code/Controllers/Event/SomeViewController.m:9: In file included from /Users/me/.jenkins/jobs/myproject/workspace/MyProject/Code/Controllers/Event/SomeViewController.h:11: In file included from /Users/me/.jenkins/jobs/myproject/workspace/MyProject/Code/Models/SomeEvent.h:10: In file included from /Users/me/.jenkins/jobs/myproject/workspace/MyProject/Code/Models/SomeRoom.h:10: /Users/me/.jenkins/jobs/myproject/workspace/MyProject/Code/Models/ABKBuilding.h:14:1: error: unexpected '@' in program @property (nonatomic, strong) NSString *buildingID; ^ [... a lot more of this] ** BUILD FAILED ** The following build commands failed: CompileC /Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/Objects-normal/armv7/SomeViewController.o MyProject/Code/Controllers/SomeViewController.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) Build step 'Execute shell' marked build as failure
到目前为止我做了什么:
Jenkins和命令行中的用户是相同的(请参阅此SO问题)
用户是构建计算机的root用户
配置正在与我设置的另一个示例项目(即它不是钥匙串问题)一起工作
我安装了当前的Xcode 5.1命令行工具并做了一本手册 xcode-select
我export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
在调用xcodebuild
命令之前使用过
我在运行Jenkins作业之前删除了DerivedData
编辑: 我忘了提到这个项目使用CocoaPods,不知道这可能是它不构建的原因.
编辑2:我添加了一些错误输出.我正在检查我的Pods文件夹到git.同一个项目在命令行上没有任何问题.命令完全没有区别,我三重检查.不幸的是,由于各种自定义原因,我无法使用Xcode插件.但即使我可以,我真的想知道两种环境之间的区别.
更新:我似乎无法在我的项目中编译一些.m文件,输出总是从一个构建到另一个构建有点不同.我还在我的构建方案中添加了一个依赖项,以确保在其他任何东西之前构建CocoaPods.
仍然不知道为什么有些文件导致了这个问题.
有人可以确认他们仍然可以用Jenkins建立项目xcodebuild Xcode 5.1 Build version 5B130a
吗?