Bob Grandish
2010-May-21 01:49 UTC
[LLVMdev] Hello example plugin has unresolved symbol in llvm 2.7
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. Sincerely, Bob
Bob Grandish
2010-May-22 00:23 UTC
[LLVMdev] Hello example plugin has unresolved symbol in llvm 2.7
--- 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
Possibly Parallel Threads
- [LLVMdev] Undefined symbol in Hello pass
- [LLVMdev] Undefined symbol in Hello pass
- [LLVMdev] LLVM Hello Pass load error when using opt -load Hello.so
- [LLVMdev] LLVM Hello Pass load error when using opt -load Hello.so
- [LLVMdev] LLVM Hello Pass load error when using opt -load Hello.so