facebook / infer

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

[Bug] CompileC failure #936

Open cyw3 opened 6 years ago

cyw3 commented 6 years ago

macOS High Sierra 10.13.2 Xcode Version 9.1 (9B55)

First, I can build this project successfully.

When infer-v0.14.0, use commands below:

xcodebuild -scheme FirstStep -configuration Debug
infer run --keep-going --jobs 8 -- xcodebuild -scheme AppName -configuration Debug -arch arm64

And Whenever I use the --no-xcpretty or infer compile, I occured: image

When infer-v0.15.0, image

After i use LD=/usr/bin/true infer run --keep-going --jobs 8 -- xcodebuild -scheme AppName -configuration Debug -arch arm64 it also become: image

So, What is the reason about this?And how to handle with ?

jvillard commented 6 years ago

Could you paste the contents of infer-out/log somewhere? (eg gist.github.com)

That said, the xcodebuild integration is not very robust so since it's not working for your project I'd suggest generating a compilation database with xcpretty and passing it to infer separately. This workflow is outlined in the online docs here. Let me know if that helps.

cyw3 commented 6 years ago

@jvillard

commands:

xcodebuild -scheme AppName -configuration Debug -arch arm64 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee  xcodebuild.log
xcpretty -r json-compilation-database -o compile_commands.json < xcodebuild.log > /dev/null
infer run --skip-analysis-in-path Pods --clang-compilation-db-files-escaped compile_commands.json

But still have a error:

/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `printf "%s" /Users/xxx/Applications/C2CDBService(MultiTable).mm'
Uncaught Internal Error: End_of_file
Error backtrace:
Raised at file "pervasives.ml", line 440, characters 14-31
Called from file "src/in_channel.ml", line 72, characters 13-30
Called from file "base/Utils.ml" (inlined), line 218, characters 13-22
Called from file "base/Utils.ml" (inlined), line 165, characters 8-12
Called from file "base/Utils.ml", line 220, characters 2-40
Re-raised at file "istd/IExn.ml" (inlined), line 13, characters 2-50
Called from file "base/Utils.ml" (inlined), line 166, characters 6-141
Called from file "base/Utils.ml", line 220, characters 2-40
Called from file "integration/CompilationDatabase.ml", line 43, characters 8-127
Called from file "integration/CompilationDatabase.ml", line 64, characters 23-40
Called from file "list.ml", line 100, characters 12-15
Called from file "list.ml" (inlined), line 100, characters 17-25
Called from file "src/list0.ml" (inlined), line 26, characters 40-75
Called from file "integration/CompilationDatabase.ml", line 104, characters 8-37
Called from file "list.ml", line 100, characters 12-15
Called from file "integration/CompilationDatabase.ml" (inlined), line 147, characters 15-36
Called from file "list.ml" (inlined), line 100, characters 12-15
Called from file "list.ml" (inlined), line 98, characters 13-64
Called from file "src/list0.ml" (inlined), line 26, characters 40-75
Called from file "integration/CompilationDatabase.ml", line 147, characters 2-50
Called from file "integration/Driver.ml", line 183, characters 29-73
Called from file "integration/Driver.ml", line 203, characters 6-63
Called from file "infer.ml", line 20, characters 2-36
Called from file "infer.ml", line 130, characters 8-54
jvillard commented 6 years ago

Could you try running with --clang-compilation-db-files instead of --clang-compilation-db-files-escaped in the last command?

cyw3 commented 6 years ago

infer run --skip-analysis-in-path Pods --clang-compilation-db-files compile_commands.json

Starting translating and linting 13767 files
error: error reading '/Users/xxx/Library/Developer/Xcode/DerivedData/xxxx/Index/DataStore'
error: error reading '/Users/xxx/Library/Developer/Xcode/DerivedData/xxxx/Index/DataStore'
1 error generated.
1 error generated.
error: error reading '/Users/xxx/Library/Developer/Xcode/DerivedData/xxxx/Index/DataStore'
1 error generated.
error: error reading '/Users/xxx/Library/Developer/Xcode/DerivedData/xxxx/Index/DataStore'
1 error generated.
Uncaught Internal Error: (Bi_inbuf.End_of_input)
Error backtrace:
Raised at file "src/bi_inbuf.ml", line 49, characters 6-24
Called from file "src/bi_io.ml" (inlined), line 508, characters 12-35
Called from file "atd/clang_ast_b.ml", line 27643, characters 7-24
Called from file "clang/Capture.ml", line 56, characters 8-39
Called from file "clang/Capture.ml" (inlined), line 101, characters 6-35
Called from file "clang/Capture.ml", line 170, characters 26-73
Re-raised at file "istd/IExn.ml" (inlined), line 18, characters 15-63
Called from file "clang/Capture.ml" (inlined), line 102, characters 4-60
Called from file "clang/Capture.ml", line 170, characters 26-73
Called from file "base/Utils.ml" (inlined), line 218, characters 13-22
Called from file "base/Utils.ml" (inlined), line 165, characters 8-12
Called from file "base/Utils.ml", line 220, characters 2-40
Re-raised at file "istd/IExn.ml" (inlined), line 13, characters 2-50
Called from file "base/Utils.ml" (inlined), line 166, characters 6-141
Called from file "base/Utils.ml", line 220, characters 2-40
Called from file "clang/Capture.ml" (inlined), line 113, characters 8-78
Called from file "clang/Capture.ml" (inlined), line 140, characters 2-37
Called from file "clang/Capture.ml", line 169, characters 8-138
Called from file "clang/ClangWrapper.ml" (inlined), line 171, characters 15-45
Called from file "list.ml" (inlined), line 100, characters 12-15
Called from file "list.ml" (inlined), line 98, characters 13-64
Called from file "src/list0.ml" (inlined), line 26, characters 40-75
Called from file "clang/ClangWrapper.ml", line 171, characters 2-54
Called from file "infer.ml", line 20, characters 2-36
Called from file "infer.ml", line 130, characters 8-54
nicolasiJasica commented 5 years ago

Have you solved this problem?

dzp181 commented 4 years ago

@jvillard

commands:

xcodebuild -scheme AppName -configuration Debug -arch arm64 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | tee  xcodebuild.log
xcpretty -r json-compilation-database -o compile_commands.json < xcodebuild.log > /dev/null
infer run --skip-analysis-in-path Pods --clang-compilation-db-files-escaped compile_commands.json

But still have a error:

/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `printf "%s" /Users/xxx/Applications/C2CDBService(MultiTable).mm'
Uncaught Internal Error: End_of_file
Error backtrace:
Raised at file "pervasives.ml", line 440, characters 14-31
Called from file "src/in_channel.ml", line 72, characters 13-30
Called from file "base/Utils.ml" (inlined), line 218, characters 13-22
Called from file "base/Utils.ml" (inlined), line 165, characters 8-12
Called from file "base/Utils.ml", line 220, characters 2-40
Re-raised at file "istd/IExn.ml" (inlined), line 13, characters 2-50
Called from file "base/Utils.ml" (inlined), line 166, characters 6-141
Called from file "base/Utils.ml", line 220, characters 2-40
Called from file "integration/CompilationDatabase.ml", line 43, characters 8-127
Called from file "integration/CompilationDatabase.ml", line 64, characters 23-40
Called from file "list.ml", line 100, characters 12-15
Called from file "list.ml" (inlined), line 100, characters 17-25
Called from file "src/list0.ml" (inlined), line 26, characters 40-75
Called from file "integration/CompilationDatabase.ml", line 104, characters 8-37
Called from file "list.ml", line 100, characters 12-15
Called from file "integration/CompilationDatabase.ml" (inlined), line 147, characters 15-36
Called from file "list.ml" (inlined), line 100, characters 12-15
Called from file "list.ml" (inlined), line 98, characters 13-64
Called from file "src/list0.ml" (inlined), line 26, characters 40-75
Called from file "integration/CompilationDatabase.ml", line 147, characters 2-50
Called from file "integration/Driver.ml", line 183, characters 29-73
Called from file "integration/Driver.ml", line 203, characters 6-63
Called from file "infer.ml", line 20, characters 2-36
Called from file "infer.ml", line 130, characters 8-54

I have same issue.