<div dir="ltr"><div><div><div><div><div><div>Hi Laszlo,<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">do you use 64 bit machine, right? (was confused about the 32 bit<br>


virtual machine story.)<br></blockquote></div>Yes, the machine is 64-bit (both the processor and the OS - using Linux Mint 14 Cinnamon btw).<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

#1 you should not link any Clang<br>
library against when you make your plugin<br></blockquote></div>How do I not link against any Clang library when I'm writing a Clang plugin? I need to use Clang's classes extensively.<br></div><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

#2 try not to use the<br>LLVM command line classes. (llvm::cl) Do the command line parsing<br>without those classes.<br></blockquote></div>I do not use llvm::cl - I'm, in fact, not doing any command line arg processing. All my plugin does is register a bunch of custom checkers to Clang Static Analyzer.<br>

<br></div><div>Thanks for the response though!<br></div><div><br></div>In the meanwhile, I realize that I have done it all with the assumption that GCC 4.7.2 and Clang 3.3 generate compatible binaries. Could this be the source of the issue? I'll try self-hosting Clang 3.3 and see what happens then.<br>

<br></div>Gabor<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/3 Laszlo Nagy <span dir="ltr"><<a href="mailto:rizsotto.mailinglist@gmail.com" target="_blank">rizsotto.mailinglist@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Gabor,<br>
<br>
do you use 64 bit machine, right? (was confused about the 32 bit<br>
virtual machine story.)<br>
<br>
My experience on plugins is, that #1 you should not link any Clang<br>
library against when you make your plugin. And #2 try not to use the<br>
LLVM command line classes. (llvm::cl) Do the command line parsing<br>
without those classes.<br>
<br>
Regards,<br>
Laszlo<br>
<div><div class="h5"><br>
On Mon, Sep 2, 2013 at 5:04 PM, Gábor Kozár <<a href="mailto:kozargabor@gmail.com">kozargabor@gmail.com</a>> wrote:<br>
> (My apologies, I sent this e-mail first from the wrong e-mail account.)<br>
><br>
> I'm using Clang 3.3. I have a Clang Static Analyzer plugin that contains the<br>
> following symbols:<br>
><br>
><br>
> extern "C" const char clang_analyzerAPIVersionString[] =<br>
> CLANG_ANALYZER_API_VERSION_STRING;<br>
> extern "C" void clang_registerCheckers(clang::ento::CheckerRegistry&<br>
> registry)<br>
><br>
><br>
> However, when I try to do something with it, like:<br>
><br>
> clang++ -c test.cpp -Xclang -load -Xclang plugin.so<br>
><br>
><br>
> I get the following output:<br>
><br>
> <premain>: CommandLine Error: Argument 'view-background' defined more than<br>
> once!<br>
> <premain>: CommandLine Error: Argument 'debug-only' defined more than once!<br>
> <premain>: CommandLine Error: Argument 'debug-buffer-size' defined more than<br>
> once!<br>
> <premain>: CommandLine Error: Argument 'debug' defined more than once!<br>
> <premain>: CommandLine Error: Argument 'version' defined more than once!<br>
> <premain>: CommandLine Error: Argument 'print-all-options' defined more than<br>
> once!<br>
> <premain>: CommandLine Error: Argument 'print-options' defined more than<br>
> once!<br>
> <premain>: CommandLine Error: Argument 'help-hidden' defined more than once!<br>
> <premain>: CommandLine Error: Argument 'help' defined more than once!<br>
> <premain>: CommandLine Error: Argument 'help-list-hidden' defined more than<br>
> once!<br>
> <premain>: CommandLine Error: Argument 'help-list' defined more than once!<br>
> clang: CommandLine Error: Argument 'view-background' defined more than once!<br>
> clang: CommandLine Error: Argument 'debug-only' defined more than once!<br>
> clang: CommandLine Error: Argument 'debug-buffer-size' defined more than<br>
> once!<br>
> clang: CommandLine Error: Argument 'debug' defined more than once!<br>
> clang: CommandLine Error: Argument 'version' defined more than once!<br>
> clang: CommandLine Error: Argument 'print-all-options' defined more than<br>
> once!<br>
> clang: CommandLine Error: Argument 'print-options' defined more than once!<br>
> clang: CommandLine Error: Argument 'help-hidden' defined more than once!<br>
> clang: CommandLine Error: Argument 'help' defined more than once!<br>
> clang: CommandLine Error: Argument 'help-list-hidden' defined more than<br>
> once!<br>
> clang: CommandLine Error: Argument 'help-list' defined more than once!<br>
><br>
><br>
> I have never encountered such an error before, and this works perfectly on a<br>
> different machine, although with 32-bit binaries (it being a 32-bit system<br>
> inside a VirtualBox).<br>
><br>
> The plugin was compiled using Clang 3.3, as a shared library, with -fPIC and<br>
> -fno-rtti. 'file plugin.so' output:<br>
><br>
> ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically<br>
> linked, not stripped<br>
><br>
><br>
> 'file clang' output:<br>
><br>
> ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked<br>
> (uses shared libs), for GNU/Linux 2.6.24,<br>
> BuildID[sha1]=0xb08840ba88f98740a0e3f4b6448e1c4b70ad57ce, not stripped<br>
><br>
><br>
> Clang (again, version 3.3) was configured with --enable-optimized, and was<br>
> built using GCC 4.7.2.<br>
><br>
> Any idea what could be the issue here?<br>
> Thanks!<br>
><br>
> --<br>
> Gábor Kozár<br>
> <a href="mailto:kozargabor@fastmail.fm">kozargabor@fastmail.fm</a><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
</blockquote></div><br></div>