[cfe-dev] Loading Static Analyzer plugin fails with CommandLine Errors

Gabor Kozar kozargabor at fastmail.fm
Mon Sep 2 08:02:43 PDT 2013


I'm using Clang 3.3. I have a Clang Static Analyzer plugin that
contains the following symbols:



extern "C" const char clang_analyzerAPIVersionString[] =
CLANG_ANALYZER_API_VERSION_STRING;

extern "C" void clang_registerCheckers(clang::ento::CheckerRegistry&
registry)



However, when I try to do something with it, like:

clang++ -c test.cpp -Xclang -load -Xclang plugin.so



I get the following output:

<premain>: CommandLine Error: Argument 'view-background' defined more
than once!

<premain>: CommandLine Error: Argument 'debug-only' defined more than
once!

<premain>: CommandLine Error: Argument 'debug-buffer-size' defined more
than once!

<premain>: CommandLine Error: Argument 'debug' defined more than once!

<premain>: CommandLine Error: Argument 'version' defined more than
once!

<premain>: CommandLine Error: Argument 'print-all-options' defined more
than once!

<premain>: CommandLine Error: Argument 'print-options' defined more
than once!

<premain>: CommandLine Error: Argument 'help-hidden' defined more than
once!

<premain>: CommandLine Error: Argument 'help' defined more than once!

<premain>: CommandLine Error: Argument 'help-list-hidden' defined more
than once!

<premain>: CommandLine Error: Argument 'help-list' defined more than
once!

clang: CommandLine Error: Argument 'view-background' defined more than
once!

clang: CommandLine Error: Argument 'debug-only' defined more than once!

clang: CommandLine Error: Argument 'debug-buffer-size' defined more
than once!

clang: CommandLine Error: Argument 'debug' defined more than once!

clang: CommandLine Error: Argument 'version' defined more than once!

clang: CommandLine Error: Argument 'print-all-options' defined more
than once!

clang: CommandLine Error: Argument 'print-options' defined more than
once!

clang: CommandLine Error: Argument 'help-hidden' defined more than
once!

clang: CommandLine Error: Argument 'help' defined more than once!

clang: CommandLine Error: Argument 'help-list-hidden' defined more than
once!

clang: CommandLine Error: Argument 'help-list' defined more than once!



I have never encountered such an error before, and this works perfectly
on a different machine, although with 32-bit binaries (it being a
32-bit system inside a VirtualBox).



The plugin was compiled using Clang 3.3, as a shared library, with
-fPIC and -fno-rtti. 'file plugin.so' output:

ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux),
dynamically linked, not stripped



'file clang' output:

ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically
linked (uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=0xb08840ba88f98740a0e3f4b6448e1c4b70ad57ce, not stripped



Clang (again, version 3.3) was configured with --enable-optimized, and
was built using GCC 4.7.2.



Any idea what could be the issue here?

Thanks!



--
Gábor Kozár
kozargabor at fastmail.fm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130902/9c25cb1d/attachment.html>


More information about the cfe-dev mailing list