Hi,<br>
<br>
I am following the instructions on Writing an LLVM Pass on
Darwin(8.7.0) powerpc.  The loadable library is built. But "opt
-load " gives error saying "Symbol not found". I am using LLVM 1.8.
Could someone tell me how to fix it? I have tried the same procedure on
Pentium4 Redhat9. Everything is ok there. So I think there must be some
specific problem on Darwin that I should pay attention to. But what is
it?<br>
<br>
Here is how I got this error.<br>
<br>
After installing cfrontend3.4 and LLVM, I included cfrontend-bin and
LLVM-installed-bin in PATH. I also set LLVM_LIB_SEARCH_PATH to be
cfrontend-lib.<br>
<br>
I copied Hello.cpp and Makefile to ~/tools/build-ppc/lib/Transforms/Hello and built the library.<br>
<br>
pollux:~/tools/build-ppc/lib/Transforms/Hello $ make<br>
llvm[0]: Compiling Hello.cpp for Release build  (PIC)<br>
llvm[0]: Linking Release Shared Library LLVMHello.so<br>
llvm[0]: Linking Release Object Library LLVMHello.o<br>
<br>
The loadable library was found on ~/tools/build-pcc/Release/lib.<br>
<br>
pollux:~/tools/build-ppc/Release/lib $ file LLVMHello*<br>
<a href="http://LLVMHello.0.0.0.so">LLVMHello.0.0.0.so</a>: Mach-O bundle ppc<br>
<a href="http://LLVMHello.0.so">LLVMHello.0.so</a>:     symbolic link to `LLVMHello.0.0.0.so'<br>
LLVMHello.a:        current ar archive<br>
LLVMHello.la:       ASCII English text<br>
LLVMHello.o:        Mach-O object ppc<br>
LLVMHello.so:       symbolic link to `LLVMHello.0.0.0.so'<br>
<br>
But when I ran opt -load, it said "symbol not found". <br>
<br>
pollux:~/test $ opt -load /Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so -help<br>
Error opening '/Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so':
Can't open :/Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so:
dlopen(/Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so, 9):
Symbol not found:
__ZN4llvm12FunctionPass16addToPassManagerEPNS_20FunctionPassManagerTERNS_13AnalysisUsageE<br>
  Referenced from: /Users/jingyu/tools/build-ppc/Release/lib/LLVMHello.so<br>
  Expected in: flat namespace<br>
<br>
<br>
I guess the problem is that the library who implements the symbol was
not found at run time, or the lib path information was not given to
LLVMHello correctly at link time. I am new to Darwin. I have tried to
set LD_LIBRARY_PATH to be llvm-installed-lib, and rebuilt LLVMHello. No
difference was found. What shall I do to fix it? Any information is
appreciated.<br>
<br>
Thanks,<br>
<br>
Jing<br>