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

Laszlo Nagy rizsotto.mailinglist at gmail.com
Tue Sep 3 02:49:13 PDT 2013


Hi Gabor,

do you use 64 bit machine, right? (was confused about the 32 bit
virtual machine story.)

My experience on plugins is, that #1 you should not link any Clang
library against when you make your plugin. And #2 try not to use the
LLVM command line classes. (llvm::cl) Do the command line parsing
without those classes.

Regards,
Laszlo

On Mon, Sep 2, 2013 at 5:04 PM, Gábor Kozár <kozargabor at gmail.com> wrote:
> (My apologies, I sent this e-mail first from the wrong e-mail account.)
>
> 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
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list