Open sgorillad opened 3 years ago
This is strange, clang 11 knows about -index-store-path
so I am not sure what is causing your issue. You can try removing this argument by adding --clang-blacklisted-flags-with-arg -index-store-path
to your infer run
command (see https://github.com/facebook/infer/issues/1382#issuecomment-801863030).
I'm also seeing this problem.
Details:
clang --version
:
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Commands:
xcodebuild -workspace "MyWorkspace.xcworkspace" -scheme "MyScheme" -sdk iphonesimulator clean build | tee xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json
infer run --skip-analysis-in-path Pods --compilation-database-escaped compile_commands.json
Error message:
clang-11: error: unknown argument: '-index-store-path'
*** Infer needs a working compilation command to run.
I was able to fix this by adding some options to the xcodebuild
step. I'm not sure which one of these fixes the Infer error referenced in this issue, but all three are required for me to generate a compile_commands.json
file that can be read by both oclint and Infer.
The options added are COMPILER_INDEX_STORE_ENABLE=NO OTHER_CFLAGS="-DNS_FORMAT_ARGUMENT(A)= -D_Nullable_result=_Nullable"
.
Full commands:
xcodebuild -workspace "MyWorkspace.xcworkspace" -scheme "MyScheme" -sdk iphonesimulator COMPILER_INDEX_STORE_ENABLE=NO OTHER_CFLAGS="-DNS_FORMAT_ARGUMENT(A)= -D_Nullable_result=_Nullable" clean build | tee xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json
infer run --skip-analysis-in-path Pods --compilation-database-escaped compile_commands.json
xcodebuild -workspace xx.xcworkspace -scheme xxx -configuration Debug -sdk iphonesimulator -UseModernBuildSystem=NO | tee 1.log
xcpretty -r json-compilation-database -o compile_commands.json < 1.log > /dev/null
infer run --skip-analysis-in-path Pods --clang-compilation-db-files-escaped compile_commands.json
i got this⬇️
Error message: clang-11: error: unknown argument: '-index-store-path'
*** Infer needs a working compilation command to run.
Usage Error: Failed to execute compilation command: '/usr/local/Cellar/infer/1.1.0/lib/infer/infer/bin/../../facebook-clang-plugins/clang/install/bin/clang' @/Users/xx/Documents/xx/Video/Video/Article/infer-out/tmp/cdb_clang_args.tmp.6edd6a.txt -fsyntax-only ++Contents of '/Users/xx/Documents/xx/Video/Video/Article/infer-out/tmp/cdb_clang_args.tmp.6edd6a.txt':