[cfe-dev] Undefined LLVM reference when loading Clang Static Analyzer plugin

Gabor Kozar kozargabor at gmail.com
Wed Oct 9 05:38:09 PDT 2013


Thanks Jordan, you were correct. Somehow llvm-config --cxxflags didn't
include the -fno-rtti flag.



--
Gábor Kozár -- ShdNx
kozargabor at gmail.com





On Thu, Oct 3, 2013, at 15:10, Gabor Kozar wrote:

Hi all,



Thank you for the answers.



I'm still not sure why you'd have a reference to it, but perhaps your
plugin is being compiled with -frtti instead of -fno-rtti?



We usually build our plugin using flags we get from llvm-config
--cxxflags --ldflags, etc. However, on this particular server, this
didn't work for some reason, so we provided the args manually. I'll
check whether we indeed missed -fno-rtti. Thanks for the tip!



After installing clang in release mode (for me ./configure
--disable-assertions --enable-optimized), the installed binary of clang
cannot load plugins any more. One needs to copy the original binary
manually and strip it with option -x (or not at all).



We are not actually installing the binary, just building it. The test
machine is a server environment where we don't have (i.e. cannot expect
to) have root access.

Thanks for mentioning it though, it's again something we have to watch
out for.



--
Gábor Kozár -- ShdNx
kozargabor at gmail.com





On Thu, Oct 3, 2013, at 5:05, Mathieu Baudet wrote:

Hi Gabor,



I was planning on reporting the following issue (or caveat) for some

time. This might explain your problem.



After installing clang in release mode (for me ./configure

--disable-assertions --enable-optimized), the installed binary of

clang cannot load plugins any more. One needs to copy the original

binary manually and strip it with option -x (or not at all).



Failing to do so gives an error comparable to the one you report.



Hoping this helps,

--

Mathieu



2013/10/2 Jordan Rose <[1]jordan_rose at apple.com>:

Running this through c++filt shows that it's a typeinfo object. I'm
still

not sure why you'd have a reference to it, but perhaps your plugin is
being

compiled with -frtti instead of -fno-rtti?



Jordan





On Oct 2, 2013, at 8:59 , Gabor Kozar <[2]kozargabor at gmail.com> wrote:



Hi,



We have a Clang Static Analyzer plugin that registers a bunch of custom

checkers. We're using LLVM and Clang 3.3.

Clang 3.3 is able to compile, and the Static Analyzer also runs without
our

plugin being loaded.



On one of our test machines (a Suse Linux 11), trying to load our
plugin

fails:



clang++ -cc1 -load lib-checkers.so

error: unable to load plugin 'lib-checkers.so': 'lib-checkers.so:
undefined

symbol: _ZTIN4llvm18RefCountedBaseVPTRE'



Our plugin does not use llvm::RefCountedBaseVPTR, although it does make

direct use of some LLVM types, such as llvm::Optional, llvm::DenseMap
and so

on.



When building our plugin, we do not link against any LLVM or Clang

libraries, except for clangASTMatchers. We also tried linking against
them,

but it doesn't seem to make any difference.

Both Clang and the plugin are built with the same compiler and on the
same

system.



As far as we can determine, this issue only appears when trying to load
our

plugin, and Clang is able to function perfectly when we don't try to
load

it.



Any idea on what could be the issue? We're totally clueless here.

Thanks!



--

Gábor Kozár -- ShdNx

[3]kozargabor at gmail.com



_______________________________________________

cfe-dev mailing list

[4]cfe-dev at cs.uiuc.edu

[5]http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev







_______________________________________________

cfe-dev mailing list

[6]cfe-dev at cs.uiuc.edu

[7]http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



_______________________________________________

cfe-dev mailing list

[8]cfe-dev at cs.uiuc.edu

[9]http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

References

1. mailto:jordan_rose at apple.com
2. mailto:kozargabor at gmail.com
3. mailto:kozargabor at gmail.com
4. mailto:cfe-dev at cs.uiuc.edu
5. http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
6. mailto:cfe-dev at cs.uiuc.edu
7. http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
8. mailto:cfe-dev at cs.uiuc.edu
9. http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131009/297c9103/attachment.html>


More information about the cfe-dev mailing list