[LLVMdev] Hello example plugin has unresolved symbol in llvm 2.7

Bob Grandish redcurbs at yahoo.com
Fri May 21 17:23:25 PDT 2010


--- On Thu, 5/20/10, Bob Grandish <redcurbs at yahoo.com> wrote:
> I built llvm-2.7 from source on
> FreeBSD-i386 with:
>   ./configure --prefix=/opt && gmake
> 
> It builds fine, but the Hello plugin fails to load with an
> unresolved symbol.
> 
> $ opt -load /opt/lib/libLLVMHello.so -help   
>        
> Error opening '/opt/lib/libLLVMHello.so':
> /opt/lib/libLLVMHello.so: Undefined symbol
> "_ZNK4llvm4Pass5printERNS_11raw_ostreamEPKNS_6ModuleE"
>   -load request ignored.
> OVERVIEW: llvm .bc -> .bc modular optimizer and analysis
> printer
> [...]
> 
> I edited the lib/Transforms/Hello/Makefile with various
> forms of LLVMLIBS, USEDLIBS, and LINK_COMPONENTS. Basically,
> I needed to include "LLVMCore.a LLVMSupport.a LLVMSystem.a"
> in order to get rid of all 3 unresolved symbols. However,
> when I tried to load that library with opt, I got the
> dreaded "pass loaded multiple times" assert.
> 
> This is the Release build. I have not tried a debug build.
> However, it's clear that the stock Hello plugin is broken in
> llvm-2.7. Please advise on how to fix the above.

I found the problem. There was another version of llvm that had been installed by the ports system. It was coming before my build of opt in the path. It seems there is some conflict between the build options used in the FreeBSD port of llvm and the normal "./configure && gmake" route. I suspect it is --enable-optimized, although I have not verified this yet.

So if you get that unresolved symbol error, check that your opt and .so library were built with the same configure settings.

Thanks,
Bob


      




More information about the llvm-dev mailing list