Clang scan-build 不适用于 Xcode 4.2 LLVM 3.0 构建配置
我已经安装了 Xcode 4.2 最终版本,以便能够针对 iOS 5 进行编译。
我们使用 Jenkins 进行 CI 并从 llvm.org 项目页面运行 Clang scan-build。 (版本 258)该项目配置为使用 LLVM 3.0(自 Xcode 4.2 起默认使用)。现在,每次我尝试运行 scan-build 时,我都会收到以下错误:
CompileC build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPContentDetailViewController_iPad.o Classes/iPad/TPContentDetailViewController_iPad.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Volumes/Sources/Starteam - Main View/Workplace/Cortado"
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/Applications/android-sdk-mac_x86/android-ndk-r6b:/Applications/android-sdk-mac_x86/platform-tools:/Applications/android-sdk-mac_x86/tools:/Volumes/Sources/Starteam - Main View/Tools:/Volumes/Sources/Tools:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
/Users/thwee/Downloads/checker-258/libexec/ccc-analyzer -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -DDEBUG -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fexceptions -fasm-blocks -fprofile-arcs -ftest-coverage -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -iquote "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-generated-files.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-own-target-headers.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-all-target-headers.hmap" -iquote "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-project-headers.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Debug-iphonesimulator/include" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/DerivedSources/i386" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/DerivedSources" "-F/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Debug-iphonesimulator" -include "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/Cortado_Prefix.pch" -MMD -MT dependencies -MF "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPContentDetailViewController_iPad.d" -c "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/Classes/iPad/TPContentDetailViewController_iPad.m" -o "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPContentDetailViewController_iPad.o"
cc1obj: error: unrecognized command line option "-Wno-sign-conversion"
cc1obj: error: unrecognized command line option "-fdiagnostics-print-source-range-info"
cc1obj: error: unrecognized command line option "-fdiagnostics-show-category=id"
cc1obj: error: unrecognized command line option "-fdiagnostics-parseable-fixits"
如果我使用 Xcode self 的静态代码分析,我会得到以下输出,该输出可以正常工作:
CompileC build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPInfoCell.o Classes/TPInfoCell.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Volumes/Sources/Starteam - Main View/Workplace/Cortado"
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -DDEBUG -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fexceptions -fasm-blocks -fprofile-arcs -ftest-coverage -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -iquote "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-generated-files.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-own-target-headers.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-all-target-headers.hmap" -iquote "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-project-headers.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Debug-iphonesimulator/include" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/DerivedSources/i386" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/DerivedSources" "-F/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Debug-iphonesimulator" -include /var/folders/m7/1lwxj7113xb17b8k635bn0200000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/Cortado_Prefix-curmpedgpezkvsgarfuwvmdrauwa/Cortado_Prefix.pch -MMD -MT dependencies -MF "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPInfoCell.d" -c "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/Classes/TPInfoCell.m" -o "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPInfoCell.o"
有人知道我可以做什么来让 scan-build 再次运行不禁用 LLVM 3.0 使用?!
I've installed Xcode 4.2 final version to be able to compile for iOS 5.
We are using Jenkins for CI and run Clang scan-build from the llvm.org project page. (Version 258) The project is configured to use LLVM 3.0 (which is default since Xcode 4.2). Now every time I try to run scan-build do I get following error:
CompileC build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPContentDetailViewController_iPad.o Classes/iPad/TPContentDetailViewController_iPad.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Volumes/Sources/Starteam - Main View/Workplace/Cortado"
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/Applications/android-sdk-mac_x86/android-ndk-r6b:/Applications/android-sdk-mac_x86/platform-tools:/Applications/android-sdk-mac_x86/tools:/Volumes/Sources/Starteam - Main View/Tools:/Volumes/Sources/Tools:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
/Users/thwee/Downloads/checker-258/libexec/ccc-analyzer -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -DDEBUG -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fexceptions -fasm-blocks -fprofile-arcs -ftest-coverage -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -iquote "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-generated-files.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-own-target-headers.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-all-target-headers.hmap" -iquote "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-project-headers.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Debug-iphonesimulator/include" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/DerivedSources/i386" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/DerivedSources" "-F/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Debug-iphonesimulator" -include "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/Cortado_Prefix.pch" -MMD -MT dependencies -MF "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPContentDetailViewController_iPad.d" -c "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/Classes/iPad/TPContentDetailViewController_iPad.m" -o "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPContentDetailViewController_iPad.o"
cc1obj: error: unrecognized command line option "-Wno-sign-conversion"
cc1obj: error: unrecognized command line option "-fdiagnostics-print-source-range-info"
cc1obj: error: unrecognized command line option "-fdiagnostics-show-category=id"
cc1obj: error: unrecognized command line option "-fdiagnostics-parseable-fixits"
If I use the static code analyze of Xcode self I get following output which works without issues:
CompileC build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPInfoCell.o Classes/TPInfoCell.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Volumes/Sources/Starteam - Main View/Workplace/Cortado"
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -DDEBUG -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fexceptions -fasm-blocks -fprofile-arcs -ftest-coverage -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -iquote "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-generated-files.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-own-target-headers.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-all-target-headers.hmap" -iquote "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Cortado-project-headers.hmap" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Debug-iphonesimulator/include" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/DerivedSources/i386" "-I/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/DerivedSources" "-F/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Debug-iphonesimulator" -include /var/folders/m7/1lwxj7113xb17b8k635bn0200000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/Cortado_Prefix-curmpedgpezkvsgarfuwvmdrauwa/Cortado_Prefix.pch -MMD -MT dependencies -MF "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPInfoCell.d" -c "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/Classes/TPInfoCell.m" -o "/Volumes/Sources/Starteam - Main View/Workplace/Cortado/build/Cortado.build/Debug-iphonesimulator/Cortado.build/Objects-normal/i386/TPInfoCell.o"
Has someone an idea what I can do to get scan-build running again without disabling LLVM 3.0 use?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
找到了一个解决方案来进行 checker-258 构建:
将此参数传递给 scan-build : --use-cc=`which clang`
然后使其由 jenkins 和 scan-build 插件构建......这有点棘手:
移动scan-build 到 scan-build.bin,然后使 scan-build 成为一个脚本:
which clang
的结果是: /usr/bin/clang编辑:为两个项目工作,一个是LLVM 3.0,其他用llvm-gcc4.2。
Found a solution to have checker-258 build :
Pass this param to scan-build : --use-cc=`which clang`
Then to make it builds by jenkins and the scan-build plugin... it's a little trickier :
Move scan-build to scan-build.bin, and then make scan-build be a script :
The result of
which clang
is : /usr/bin/clangEdit: worked for two projects, one with LLVM 3.0, the other with llvm-gcc4.2.
我向 Apple 提出了关于此问题和其他问题的错误(例如 scan-build 无法识别 ARC 代码)。
修复方法是安装 checker-260,请参阅 http://clang-analyzer.llvm.org/release_notes .html 加上对 ccc-analyzer 的修改 - http://llvm.org/viewvc/llvm-project?view=rev&revision=149094。希望 ccc-analyzer 的修复将被纳入 scan-build 的未来版本中。
使用这个最新版本的 scan-build 将避免您必须对上一个答案中描述的 scan-build 进行修改。
I raised a bug with Apple about this and other issues (like scan-build not recognising ARC'd code).
The fix is to install checker-260, see http://clang-analyzer.llvm.org/release_notes.html plus this modification to ccc-analyzer - http://llvm.org/viewvc/llvm-project?view=rev&revision=149094. Hopefully the fix to ccc-analyzer will be incorporated into a future release of scan-build.
Using this latest version of scan-build will avoid you having to make the modifications to scan-build described in the previous answer.
看起来 scan-build 决定使用 llvm-gcc,这让 Xcode 感到困惑,因为它期望运行 clang。可能只是扫描构建中的一个错误;我建议向 cfe-dev 发送电子邮件。
It looks like scan-build is deciding to use llvm-gcc, which is confusing Xcode because it is expecting to be running clang. Probably just a bug in scan-build; I'd suggest sending an email to cfe-dev.