title: Undefined symbol when loading LLVM plugin
body: <p>I am developing an LLVM pass and want to run it as a plugin via the Clang LLVM driver:</p>
  
  <pre><code>clang -Xclang -load -Xclang myPlugin.so ...
  </code></pre>
  
  <p>At first I got an error similar to that described here</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/37366291/undefined-symbol-for-self-built-llvm-opt">undefined symbol for self-built llvm opt?</a></li>
  </ul>
  
  <p>After applying the flag <code>-D_GLIBCXX_USE_CXX11_ABI=0</code> as suggested, I'm getting this error:</p>
  
  <pre><code>error: unable to load plugin 'myPlugin.so': 'myPlugin.so: undefined symbol: _ZNK4llvm12FunctionPass17createPrinterPassERNS_11raw_ostreamERKSs
  </code></pre>
  
  <p>This page suggests that there may be an ABI compatibility issue (which I don't fully understand)</p>
  
  <ul>
  <li><a href="http://clang-developers.42468.n3.nabble.com/Loading-Static-Analyzer-plugin-fails-with-CommandLine-Errors-td4034194.html" rel="nofollow noreferrer">http://clang-developers.42468.n3.nabble.com/Loading-Static-Analyzer-plugin-fails-with-CommandLine-Errors-td4034194.html</a></li>
  </ul>
  
  <p>My objective is to compile the pass with either GCC or Clang and run it with the system Clang installation (Ubuntu 16.04, LLVM 3.8) rather than building Clang/LLVM from source.</p>