<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
While learning to write LLVM passes and following the precise
instructions under <a
 href="http://llvm.org/docs/WritingAnLLVMPass.html">http://llvm.org/docs/WritingAnLLVMPass.html,
</a><br>
I got this error when loading the hello pass to run the test program:<br>
<br>
opt -load ./Release/lib/Hello.so -hello < test/test.bc > /dev/null<br>
Error opening './Release/lib/Hello.so': ./Release/lib/Hello.so:
undefined symbol:
_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i<br>
  -load request ignored.<br>
  opt: Unknown command line argument '-hello'.  Try: 'opt --help'<br>
  make: *** [run_lib] Error 1<br>
<br>
I think I might have missed a LLVM lib file, but can't figure out which.<br>
<br>
I double checked the Makefile, it does have the libLLVMCore.a,
libLLVMSystem.a and libLLVMSupport.a specified.<br>
<br>
Could people suggest?<br>
<br>
All are based on the LLVM  2.5 release, running on Debian4-i386.<br>
<br>
Thank you very much<br>
<br>
Chuck<br>
<br>
<br>
<br>
Hello.cpp file:<br>
#include "llvm/Pass.h"<br>
#include "llvm/Function.h"<br>
<br>
using namespace llvm;<br>
<br>
namespace {<br>
  struct Hello : public FunctionPass {<br>
    <br>
    static char ID;<br>
    Hello() : FunctionPass(&ID) {}<br>
<br>
    virtual bool runOnFunction(Function &F) {<br>
      llvm::cerr << "Hello: " << F.getName() << "\n";<br>
      return false;<br>
    }<br>
  };<br>
  <br>
  char Hello::ID = 0;<br>
  RegisterPass<Hello> X("hello", "Hello World Pass");<br>
}<br>
<br>
<br>
Makefile:<br>
# Makefile for hello pass<br>
<br>
# Path to top level of LLVM heirarchy<br>
LEVEL = .<br>
<br>
# Name of the library to build<br>
LIBRARYNAME = Hello<br>
<br>
# Make the shared library become a loadable module so the tools can <br>
# dlopen/dlsym on the resulting library.<br>
LOADABLE_MODULE = 1<br>
<br>
# Tell the build system which LLVM libraries your pass needs. You'll
probably<br>
# need at least LLVMSystem.a, LLVMSupport.a, LLVMCore.a but possibly
several<br>
# others too.<br>
LLVMLIBS = LLVMCore.a LLVMSupport.a LLVMSystem.a<br>
<br>
# Include the makefile implementation stuff<br>
include $(LEVEL)/Makefile.common<br>
<br>
<br>
</body>
</html>