xcode目标构建中的scan-build链接器错误失败,但在xcodebuild中正确链接

时间:2012-12-12 21:45:03

标签: xcode xcode4 jenkins continuous-integration scan-build

因此在使用scan-build

时构建xcode项目时出现链接器错误

对于我的普通xcodebuild命令,我使用以下

  

xcodebuild -target LibCoreMobileGHUnit -configuration Debug -sdk iphonesimulator5.0 clean build

并且它使用以下选项进行链接器阶段

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
-demangle
-dynamic
-arch i386
-all_load
-ios_simulator_version_min 5.0.0
-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk
-ObjC
-o /Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/build/Debug-iphonesimulator/LibCoreMobileGHUnit.app/LibCoreMobileGHUnit
-lcrt1.o
-L/Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/build/Debug-iphonesimulator
-filelist /Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/build/LibCoreMobile.build/Debug-iphonesimulator/LibCoreMobileGHUnit.build/Objects-normal/i386/LibCoreMobileGHUnit.LinkFileList
-objc_abi_version 2
-no_implicit_dylibs
-lz
-framework QuartzCore
-framework UIKit
-framework Foundation
-framework CoreGraphics
-framework GHUnitIOS
-force_load /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a
-framework Foundation
-lobjc
-lc++ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.profile_ios.a
-lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.ios.a
-F/Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/build/Debug-iphonesimulator
-F/Applications/Xcode.app/Contents/Developer/Library/Frameworks
-F/Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/LibCoreMobileGHUnit
-F/Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/ExternalFrameworks

这是成功的

然而,当我运行以下

scan-build -k -v -v -o ../clangScanBuildReports xcodebuild -target LibCoreMobileGHUnit -configuration Debug -sdk iphonesimulator5.0 clean build

它与以下选项相关联:

"/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld"
-dynamic
-arch i386
-all_load
-ios_simulator_version_min 5.0.0
-syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk
-ObjC
-o /Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/build/Debug-iphonesimulator/LibCoreMobileGHUnit.app/LibCoreMobileGHUnit
-lcrt1.o
-L/Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/build/Debug-iphonesimulator
-filelist /Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/build/LibCoreMobile.build/Debug-iphonesimulator/LibCoreMobileGHUnit.build/Objects-normal/i386/LibCoreMobileGHUnit.LinkFileList
-objc_abi_version 2
-no_implicit_dylibs
-lz
-framework QuartzCore
-framework UIKit
-framework Foundation
-framework CoreGraphics
-framework GHUnitIOS
-force_load /Users/ops/tools/checker-269/lib/arc/libarclite_iphonesimulator.a
-framework Foundation
-lobjc
-lc++
-lSystem
-F/Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/build/Debug-iphonesimulator
-F/Applications/Xcode.app/Contents/Developer/Library/Frameworks
-F/Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/LibCoreMobileGHUnit
-F/Users/ops/workspace/MobileFramework_Test_IOS_Client/LibCoreMobile/ExternalFrameworks

所以这里有一些不同的东西 在运行scan-build时,似乎使用了不同的链接器 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld vs /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld

在正常的xcodebuild中它有一个额外的选项-demangle 并且在扫描构建中它缺少两个libclang库

-lc++ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.profile_ios.a
-lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.ios.a

有谁知道我如何强制将libaries包含在“scan-build”执行的链接器标志中。

0 个答案:

没有答案