facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.8k stars 2k forks source link

infer run return err clang-15: error: unknown argument: '-ivfsstatcache' #1749

Open pastel001 opened 1 year ago

pastel001 commented 1 year ago

infer --version
Infer version v1.1.0-7fb6d4011 Copyright 2009 - present Facebook. All Rights Reserved.

Mac mini
Apple M1 Ventura 13.3

xcodebuild -version
Xcode 14.3 Build version 14E222b

command infer run --keep-going --skip-analysis-in-path Pods --compilation-database-escaped compile_commands.json

log:

clang-15: error: unknown argument: '-ivfsstatcache'

*** Infer needs a working compilation command to run.

Usage Error: Failed to execute compilation command:
'/usr/local/lib/infer/infer/bin/../../facebook-clang-plugins/clang/install/bin/clang'
  @/Users/Shared/Jenkins/workspace/ios_test/infer-out/tmp/cdb_clang_args.tmp.89ff0b.txt
  -fsyntax-only -fno-builtin  ++Contents of '/Users/Shared/Jenkins/workspace/ios_test/infer-out/tmp/cdb_clang_args.tmp.89ff0b.txt':
                                 -x c -ivfsstatcache /Users/xxx/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphoneos16.4-20E238-.sdkstatcache -target arm64-apple-ios9.0 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu11 -fmodules -gmodules -fmodules-cache-path\=/Users/xxx/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/xxx/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -fmodule-name\=LzmaSDK_ObjC -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DPOD_CONFIGURATION_DEBUG\=1 -DDEBUG\=1 -DCOCOAPODS\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -iquote /Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/LzmaSDK_ObjC-generated-files.hmap -I/Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/LzmaSDK_ObjC-own-target-headers.hmap -I/Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/LzmaSDK_ObjC-all-non-framework-target-headers.hmap -ivfsoverlay /Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/all-product-headers.yaml -iquote /Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/LzmaSDK_ObjC-project-headers.hmap -I/Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Products/Debug-iphoneos/LzmaSDK-ObjC/include -I/Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/DerivedSources-normal/arm64 -I/Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/DerivedSources/arm64 -I/Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/DerivedSources -F/Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Products/Debug-iphoneos/LzmaSDK-ObjC -DNS_FORMAT_ARGUMENT\(A\)\= -D_Nullable_result\=_Nullable -DLZMASDKOBJC\=1 -DLZMASDKOBJC_OMIT_UNUSED_CODE\=1 -w -Xanalyzer -analyzer-disable-all-checks -include /Users/Shared/Jenkins/workspace/ios_test/Pods/Target\ Support\ Files/LzmaSDK-ObjC/LzmaSDK-ObjC-prefix.pch -MMD -MT dependencies -MF /Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/Objects-normal/arm64/Ppmd7.d --serialize-diagnostics /Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/Objects-normal/arm64/Ppmd7.dia -c /Users/Shared/Jenkins/workspace/ios_test/Pods/LzmaSDK-ObjC/lzma/C/Ppmd7.c -o /Users/xxx/Library/Developer/Xcode/DerivedData/testiOS-etqfnkjdhckdayfrbdjnysttvzvd/Build/Intermediates.noindex/LzmaSDK-ObjC.build/Debug-iphoneos/LzmaSDK-ObjC.build/Objects-normal/arm64/Ppmd7.o
songgeb commented 1 year ago

维护infer的成本比较高,clang官方增加的特性都可能潜在导致infer不能工作,太难了

songgeb commented 1 year ago

将-ivfsstatcache参数移除掉即可

jvillard commented 1 year ago

You can use --clang-block-listed-flags-with-arg -ivfsstatcache so that infer doesn't pass that argument down to its own clang (which is at a different version than Apple's clang, which is why it doesn't know this argument).

songgeb commented 1 year ago

@jvillard

  1. black, not block
  2. this option does not appear to be working. error is still there
dingxiaolong commented 1 year ago

Is any progress about this issue ? I also face this error ,on M1 with the latest mac os version

dingxiaolong commented 1 year ago

You can use --clang-block-listed-flags-with-arg -ivfsstatcache so that infer doesn't pass that argument down to its own clang (which is at a different version than Apple's clang, which is why it doesn't know this argument).

Hi, I use this ,but still have this error , is there anything wrong about this :"infer run --keep-going --skip-analysis-in-path Pods --clang-block-listed-flags-with-arg -ivfsstatcache --clang-compilation-db-files-escaped compile_commands.json " ?

Error message is "Error message: clang-16: error: unknown argument: '-ivfsstatcache' "

Could you help check it please . Many thanks .

armitis commented 11 months ago

将-ivfsstatcache参数移除掉即可 怎么移除

pastel001 commented 11 months ago

将-ivfsstatcache参数移除掉即可

@songgeb 请问下你说的这个参数移除掉是什么意思?怎么操作 我后来又测试了,只有使用compile_commands.json解析这种方式才会报这个错误,infer run -- xcodebuild的方式是没有问题的。 而且就像上面说的有人测试了--clang-block-listed-flags-with-arg -ivfsstatcache,这个使用compile_commands.json解析的时候也不好用,谢谢

songgeb commented 10 months ago

就是将json文件中这个参数及其value都删掉

发自我的iPhone

在 2023年8月15日,下午8:09,zhengzhiwen @.***> 写道:

 将-ivfsstatcache参数移除掉即可

@songgeb 请问下你说的这个参数移除掉是什么意思?怎么操作 我后来又测试了,只有使用compile_commands.json解析这种方式才会报这个错误,infer run -- xcodebuild的方式是没有问题的。 而且就像上面说的有人测试了--clang-block-listed-flags-with-arg -ivfsstatcache,这个使用compile_commands.json解析的时候也不好用,谢谢

他的意思应该是把compile_commands.json里的ivfsstatcache删除,我试了还是会报错,我是m1的电脑

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

armitis commented 10 months ago

m1的机器上,移除ivfsstatcache参数后,还会报其他错误:

fatal error: could not build module 'Foundation'

songgeb commented 8 months ago

To be honest, I strongly do not recommend use infer. It can only find some simple mistakes that most experienced engineers do not make.

Vincentzzg commented 8 months ago

将-ivfsstatcache参数移除掉即可

@songgeb 请问下你说的这个参数移除掉是什么意思?怎么操作 我后来又测试了,只有使用compile_commands.json解析这种方式才会报这个错误,infer run -- xcodebuild的方式是没有问题的。 而且就像上面说的有人测试了--clang-block-listed-flags-with-arg -ivfsstatcache,这个使用compile_commands.json解析的时候也不好用,谢谢

@pastel001 infer run -- xcodebuild 这种方式的完整命令是什么

FirstDKS521 commented 7 months ago

说实话,我强烈不建议使用infer。它只能发现一些大多数有经验的工程师不会犯的简单错误。

OCLint也有问题,没有适配最新的Xcode15,也是各种报错,还有哪个好用检测工具推荐吗?太难了😂

YiFan-Tong commented 2 months ago

可以使用 sed -i '' 's/-ivfsstatcache[^\"]*\.sdkstatcache//g' "/Users/**/Desktop/***/***/compile_commands.json" 先处理json文件,然后在使用infer run 去分析json文件