rizsotto / scan-build

Clang's scan-build re-implementation in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash in analyze-build

michaeleiselsc opened this issue · comments

Hi, when running analyze-build in a project with a JSON compilation database, I get the following error:

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 295, in run
    test_var = exclude(opts)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 260, in wrapper
    return function(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 545, in exclude
    return continuation(opts)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 260, in wrapper
    return function(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 527, in classify_parameters
    return continuation(opts)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 260, in wrapper
    return function(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 458, in arch_check
    return continuation(opts)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 260, in wrapper
    return function(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 436, in language_check
    return continuation(opts)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 260, in wrapper
    return function(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 406, in filter_debug_flags
    return continuation(opts)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 260, in wrapper
    return function(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 394, in run_analyzer
    continuation(opts)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 260, in wrapper
    return function(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/libscanbuild/analyze.py", line 361, in report_failure
    handle.write(opts['error_output'])
TypeError: expected a character buffer object

Any ideas what might be the problem? Thanks!

It gets triggered I think because I enabled the clang checks in the build options rather than in args passed to analyze-build. Without those args, everything is ok. So I'm fine

ah, i see the problem: i was using the format that oclint generates for compile_commands.json, and not this one

is there some way we could get it to work together with the other format? for example, could i just give intercept-build the output of an xcodebuild command so it wouldn't have to recompile? i don't want to have to do a full compile for each check

Hi Michael, thanks for the report. I'm not familiar what format oclint generates for compile_commands.json. You refer it as other format, but I'm missing context... I wish I can help, but then please be more verbose what you are doing and how. (It might be a real bug in scan-build, so I would be happy to spend time to fix it. But I need details to reproduce it on my machine or on the build servers. Or just understand a bit more than somebody made something and the program I've wrote crashed like this. :))

actually now that i think about it, i think it's a difference not between oclint and these libs, but between xcpretty and these libs. if you do:

xcodebuild ... | xcpretty -r json-compilation-database

then you'll see the json format that i'm describing, where all the command line arguments have been put into one string. the other difference is it seems like scan-build etc. add other arguments in there?

oclint just has you use that format. not sure if there's an official canonical compilation database format

Sorry Michael, I can't run xcodebuild on my linux machine. Also not familiar with oclint, so I don't know what "other" or "that" format means... You might be interested to read this. Feel free to reopen the ticket. But if you do, please provide command line what made the crash, the input and the output of the program. (These are the bare minimum I need to start inspecting the problem.)