rizsotto / scan-build

Clang's scan-build re-implementation in python
Other
362 stars 34 forks source link

Clang returned non-zero exit status. #94

Closed ryosa closed 7 years ago

ryosa commented 7 years ago

Does analyze-build support clang 3.4? I ran analyze-build from jenkins and here is a part of the log.

[workspace] $ /bin/sh /tmp/hudson2890606560963407518.sh analyze-build: analysis failed: %s Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/libscanbuild/analyze.py", line 406, in run_analyzer output = run_command(cmd, cwd=cwd) File "/usr/lib/python2.7/site-packages/libscanbuild/init.py", line 78, in run_command raise ex CalledProcessError: Command '['/usr/bin/clang-3.4', '-cc1', '-triple', 'x86_64-redhat-linux-gnu', '-analyze', '-disable-free', '-disable-llvm-verifier', '-main-file-name', 'THRC_SharedMemory.cpp', '-analyzer-store=region', '-analyzer-opt-analyze-nested-blocks', '-analyzer-eagerly-assume', '-analyzer-checker=core', '-analyzer-checker=unix', '-analyzer-checker=deadcode', '-analyzer-checker=cplusplus', '-analyzer-checker=security.insecureAPI.UncheckedReturn', '-analyzer-checker=security.insecureAPI.getpw', '-analyzer-checker=security.insecureAPI.gets', '-analyzer-checker=security.insecureAPI.mktemp', '-analyzer-checker=security.insecureAPI.mkstemp', '-analyzer-checker=security.insecureAPI.vfork', '-analyzer-output', 'plist', '-w', '-mrelocation-model', 'static', '-mdisable-fp-elim', '-fmath-errno', '-masm-verbose', '-mconstructor-aliases', '-munwind-tables', '-fuse-init-array', '-target-cpu', 'x86-64', '-target-linker-version', '2.23.52.0.1', '-resource-dir', '/usr/bin/../lib/clang/3.4.2', .... (omit -D and -I) .... '-internal-isystem', '/bin/../lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5', '-internal-isystem', '/bin/../lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux', '-internal-isystem', '/bin/../lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward', '-internal-isystem', '/bin/../lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/x86_64-redhat-linux/c++/4.8.5', '-internal-isystem', '/usr/local/include', '-internal-isystem', '/usr/bin/../lib/clang/3.4.2/include', '-internal-externc-isystem', '/include', '-internal-externc-isystem', '/usr/include', '-Wno-deprecated-declarations', '-Wno-trigraphs', '-Wno-unused-but-set-variable', '-Wno-uninitialized', '-Wno-conversion-null', '-fdeprecated-macro', '-fdebug-compilation-dir', '/root/ymph3/src/syssrc/extdrv', '-ferror-limit', '19', '-fmessage-length', '0', '-mstackrealign', '-fobjc-runtime=gcc', '-fcxx-exceptions', '-fexceptions', '-fdiagnostics-show-option', '-vectorize-slp', '-analyzer-output=html', '-o', '/tmp/scan-build-2017-11-08-10-40-56-999020-qEEili', '-x', 'c++', '/root/ymph3/src/syssrc/extdrv/THRC_SharedMemory.cpp']' returned non-zero exit status 1

The compilation db was like this.

{ "directory": "/root/ymph3/src/syssrc/extdrv", "arguments": [ "c++", "-DHAVE_CONFIG_H", (omit "-I") "-Wall", "-Wno-deprecated-declarations", "-Wno-trigraphs", "-Wno-unused-but-set-variable", "-Wno-uninitialized", "-Wno-conversion-null", "-Werror", (omit -D) "-c", "SharedMemory.cpp" ], "file": "SharedMemory.cpp" },

The db was generated by https://github.com/nickdiego/compiledb-generator

I wonder if later version of clang, installed in another directory, can be specified to analyze-build.

rizsotto commented 7 years ago

Hey, I can't say deffinite answer about the Clang version. (The current CI runs against 4.0, but the previous version a year ago was 3.4.) So it probably works with that too... You can specify another version with --use-analyzer flag too.

Not sure what you are doing, but I smell that this is unrelated to this tool. :) Does your project compiles with Clang? (There are cases when it compiles fine with GCC but fails with Clang.) Because that's a pre-requisit for static analisis.

ryosa commented 7 years ago

@rizsotto No, the project builds with gcc, so I've not built it with clang. By differential development, some part of the project was written 14 years ago, clang may dislike the old passages... Please close this. I will reopen if needed. Cheers!