Git Product home page Git Product logo

Comments (11)

daneov avatar daneov commented on May 17, 2024 3

Workaround

Generate a json compilation database

If you add the following parameter to

  • xctool: -reporter json-compilation-database:compile_commands.json
  • xcpretty: -r json-compilation-database -o compile_commands.json

This'll enable you to use one of the following commands:

Depending on how you generate this file you use one of the following options:

  • xcpretty and xctool: --clang-compilation-db-files-escaped
    • reason: the files in the json are escaped : 'file\ with\ spaces'
  • cmake: --clang-compilation-db-files

Granted, it'd be a 2 step process, but it'll work 👍

NB Commonly, the build output will be stored in a file called 'xcodebuild.log'. If you need a different reporter for e.g. your test, you can still do that, generate the compile_commands.json using that log file, and launch infer using that generated compile_commands.json

Concretely:

  1. xctool.sh --<whatever parameters you need> -reporter json-compilation-database:compile_commands.json or xcodebuild --<whatever parameters> | tee xcodebuild.log | xcpretty -r junit -o junit.xml as usual
  2. cat xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json &> /dev/null
    • the last part pipes the output to /dev/null, as otherwise it'd be displayed on screen again, convoluting your build log.
  3. infer --skip-analysis-in-path Pods --clang-compilation-db-files-escaped compile_commands.json

Thanks @jvillard for the assistance 🖖

from infer.

lichanghong avatar lichanghong commented on May 17, 2024 1

bash-3.2$ infer run --skip-analysis-in-path Pods --compilation-database-escaped compile_commands.json
Capturing using compilation database...
Starting translating and linting 45 files
error: error reading '/Users/ziroom/Library/Developer/Xcode/DerivedData/Example-ghajruwcoslwhscqfuynkquodwys/Index/DataStore'
error: error reading '/Users/ziroom/Library/Developer/Xcode/DerivedData/Example-ghajruwcoslwhscqfuynkquodwys/Index/DataStore'
error: error reading '/Users/ziroom/Library/Developer/Xcode/DerivedData/Example-ghajruwcoslwhscqfuynkquodwys/Index/DataStore'
1 error generated.
1 error generated.
error: error reading '/Users/ziroom/Library/Developer/Xcode/DerivedData/Example-ghajruwcoslwhscqfuynkquodwys/Index/DataStore'
1 error generated.
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

from infer.

triage avatar triage commented on May 17, 2024

this sounds like the better option... I certainly see why they specifically excluded options not supported by the open source compiler, but Infer is basically unusable to most of us using xcode and @import

from infer.

loufranco avatar loufranco commented on May 17, 2024

xctool still uses clang -- which needs their plugin, which enabled by the open source clang, so ... still won't work unfortunately.

I got pretty far adding xctool myself, but was stopped by the -fmodules issue

from infer.

wzpan avatar wzpan commented on May 17, 2024

+1 . xctool is better than xcodebuild.

from infer.

irpap avatar irpap commented on May 17, 2024

Thanks for reporting this. I think this should be doable, we'll take a look.

from infer.

jvillard avatar jvillard commented on May 17, 2024

@loufranco FYI the @import issue has been fixed in the latest version of Infer (v0.1.1).

from infer.

skyuplam avatar skyuplam commented on May 17, 2024

+1

from infer.

xilin avatar xilin commented on May 17, 2024

+1

from infer.

daneov avatar daneov commented on May 17, 2024

+1

from infer.

jvillard avatar jvillard commented on May 17, 2024

Closing as the compilation database approach is the best option there. This workflow has been documented on the infer website.

from infer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.