Mac下静态分析工具infer安装错误汇总

最近在研究infer时,遇到按照官方方法直接brew安装后cd 到项目目录,运行

> infer -- xcodebuild -target App目录 -configuration Debug -sdk iphonesimulator

后出现报错

(''')

Capturing in xcodebuild mode...

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Internal Error:  /usr/local/Cellar/infer/0.15.0/lib/infer/infer/bin/../lib/python/infer.py

  -j 4 --project-root /Users/xxxxx/Desktop/other/test/test1 --out

  /Users/xxxxxx/Desktop/other/test/test1/infer-out -- xcodebuild

  -target test1 -configuration Debug -sdk iphonesimulator:

  exited with code 1

(''')

Error backtrace:

Raised at file "base/Die.ml" (inlined), line 25, characters 6-36

Called from file "base/Logging.ml", line 314, characters 58-80

Called from file "integration/Driver.ml", line 159, characters 2-16

Called from file "integration/Driver.ml", line 280, characters 6-420

Called from file "infer.ml", line 20, characters 2-36

Called from file "infer.ml", line 130, characters 8-54

Run the command again with `--keep-going` to try and ignore this error.

(''')

网上找到的解决方法如下

(''')

1. 执行运行脚本的命令:报错如下“

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

2. 执行“

xcodebuild -showsdks

”,报错如下“

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

3. 执行“

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/

”切换到当前Xcode路径下

4. 执行"

 xcodebuild -showsdks

":

5. 执行"

xcrun --sdk iphoneos --show-sdk-path

"

结果“

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk

6. 运行脚本命令成功

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容