<div dir="ltr">Hi John,<div><br></div><div>Thanks for the hints!</div><div><br></div><div>After some grep and nm magic, it seems like I had to do the following:</div><div><br></div><div>- Run configure in the root directory</div>

<div>- Run make in ./lib/Support</div><div>- Add 'USEDLIBS = LLVMSupport.a' in the Hello Makefile</div><div><br></div><div>Now, I see:</div><div><div>$ opt -load ../../../Debug+Asserts/lib/LLVMHello.so -hello < hello.bc > /dev/null</div>

<div>Hello: main</div></div><div><br></div><div>Another workaround was to turn off thread support by setting LLVM_ENABLE_THREADS to 0 in llvm-config.h.  Not sure what the implications of this are though.</div><div><br></div>

<div>I detail the changes needed above so that the llvm maintainers can consider updating the tutorial.  </div><div><br></div><div>As another side, the tutorial suggests that the output of opt command above will be following:</div>

<div><div>$ opt -load ../../../Debug+Asserts/lib/Hello.so -hello < hello.bc > /dev/null</div><div>Hello: __main</div><div>Hello: puts</div><div>Hello: main</div></div><div><br></div><div>But hello.bc defines just one function: main so I see a different output.  Another update that can be considered for the tutorial.</div>

<div><br></div><div>Thanks,</div><div>Akhi</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 9 July 2014 16:57, John Criswell <span dir="ltr"><<a href="mailto:jtcriswel@gmail.com" target="_blank">jtcriswel@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="">
    <div>On 7/9/14, 1:56 AM, Akhi Singhania
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>I'm making my way through the WritingAnLLVMPass tutorial
          and hitting the following issue.</div>
        <div><br>
        </div>
        <div>
          <div>$ opt -load ../../../Debug+Asserts/lib/LLVMHello.so
            -hello < hello.bc > /dev/null</div>
          <div>opt: symbol lookup error:
            ../../../Debug+Asserts/lib/LLVMHello.so: undefined symbol:
            AnnotateHappensAfter</div>
        </div>
      </div>
    </blockquote>
    <br></div>
    If AnnotateHappensAfter is from one of the LLVM libraries, then you
    must make sure your pass links with that library.  When you find the
    library that AnnotateHappensAfter lives in, be sure that library is
    included in the LINK_COMPONENTS or USED_LIBS variable in your
    Makefile.<br>
    <br>
    That's what I suspect the problem is, anyway.<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
    <blockquote type="cite"><div class="">
      <div dir="ltr">
        <div><br>
        </div>
        <div>nm -g ../../../Debug+Asserts/lib/LLVMHello.so</div>
        <div>
          <div>                 U AnnotateHappensAfter</div>
        </div>
        <div>...</div>
        <div><br>
        </div>
        <div>
          <div>$ ldd ../../../Debug+Asserts/lib/LLVMHello.so </div>
          <div><span style="white-space:pre-wrap"> </span>linux-vdso.so.1
            =>  (0x00007fffa87fe000)</div>
          <div><span style="white-space:pre-wrap"> </span>libz.so.1
            => /lib64/libz.so.1 (0x00007f21b409e000)</div>
          <div><span style="white-space:pre-wrap"> </span>libpthread.so.0
            => /lib64/libpthread.so.0 (0x00007f21b3e80000)</div>
          <div><span style="white-space:pre-wrap"> </span>libtinfo.so.5
            => /lib64/libtinfo.so.5 (0x00007f21b3c56000)</div>
          <div><span style="white-space:pre-wrap"> </span>libdl.so.2
            => /lib64/libdl.so.2 (0x00007f21b3a52000)</div>
          <div><span style="white-space:pre-wrap"> </span>libm.so.6
            => /lib64/libm.so.6 (0x00007f21b374a000)</div>
          <div><span style="white-space:pre-wrap"> </span>libstdc++.so.6
            => /lib64/libstdc++.so.6 (0x00007f21b3442000)</div>
          <div><span style="white-space:pre-wrap"> </span>libgcc_s.so.1
            => /lib64/libgcc_s.so.1 (0x00007f21b322c000)</div>
          <div><span style="white-space:pre-wrap"> </span>libc.so.6
            => /lib64/libc.so.6 (0x00007f21b2e6c000)</div>
          <div><span style="white-space:pre-wrap"> </span>/lib64/ld-linux-x86-64.so.2
            (0x0000003baaa00000)</div>
        </div>
        <div><br>
        </div>
        <div>Am I not linking against some library I should have?</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div>Akhi</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div><pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div>