Hi Cristianno,<div><br></div><div>I have used default options for configure(<span style="background-color:rgb(255,255,255);font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:13px;line-height:21px">llvm/configure && </span><tt class="docutils literal" style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em;line-height:21px;background-color:rgb(255,255,255)"><span class="pre">make</span></tt><span style="background-color:rgb(255,255,255);font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:13px;line-height:21px">).</span></div>
<div><br></div><div>Thanks for your advice. After I set the environment var DYLD_LIBRARY_PATH to /usr/local/lib/ ,  the exception is gone.</div><div><br></div><div>Somehow the library is not linked into opt for reasons I don't know.</div>
<div><br></div><div>Thank you so much for your help!</div><div><br></div><div>Best,</div><div>Weibo</div><div><br></div><div><br><div class="gmail_quote">On Fri, Apr 12, 2013 at 11:17 AM, Cristianno Martins <span dir="ltr"><<a href="mailto:cristiannomartins@gmail.com" target="_blank">cristiannomartins@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 dir="ltr">Hi <span style="font-family:arial,sans-serif;font-size:13px">Weibo,</span><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">I thought would be more efficient discussing here (I just saw that every info was replicated on both emails you were sending to me).</span></div>


<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">I just run your example here on my working machine, and I didn't have any issues with the namespace. Just tell me one thing: which line (and flags) are you using when configuring and make your build llvm directory?</span></div>


<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Oh, and one more thing: what is on your $PATH?</span></div><div>

<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Cheers,</span></div></div><div class="gmail_extra"><br clear="all"><div><br>
--<br>
Cristianno Martins<br>PhD Student of Computer Science<br>University of Campinas<br><a href="mailto:cmartins@ic.unicamp.br" target="_blank">cmartins@ic.unicamp.br</a><br><a href="mailto:cristiannomartins@hotmail.com" target="_blank"></a></div>
<div><div class="h5">


<br><br><div class="gmail_quote">On Fri, Apr 12, 2013 at 12:03 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div>
    <div>On 4/12/13 9:51 AM, Bill He wrote:<br>
    </div>
    <blockquote type="cite">
      
      Thanks for your reply, John.
      <div><br>
      </div>
      <div>I am using opt to run my pass. Should opt by default link in
        the library? Would you please give me some idea on fixing it?
        Thanks!</div>
    </blockquote>
    <br></div>
    Odd.  I would think that opt would have that pass linked in
    statically.<br>
    <br>
    I'm not sure why it's not working.  Does anyone else have an idea?<br>
    <br>
    -- John T.<div><div><br>
    <br>
    <blockquote type="cite">
      <div><br>
      </div>
      <div>opt -load ../../../Debug+Asserts/lib/LLVMHello.dylib -hello
        < hello.bc > /dev/null </div>
      <div><br>
      </div>
      <div> My pass is just:</div>
      <div><br>
      </div>
      <div>
        <div>#include "llvm/IR/Function.h"</div>
        <div>#include "llvm/Pass.h"</div>
        <div>#include "llvm/Support/raw_ostream.h"</div>
        <div>#include "llvm/Analysis/Dominators.h"</div>
        <div><br>
        </div>
        <div>using namespace llvm;</div>
        <div><br>
        </div>
        <div>namespace {</div>
        <div>  struct Hello : public FunctionPass { </div>
        <div>    static char ID;</div>
        <div>    Hello() : FunctionPass(ID) { } </div>
        <div>    virtual void getAnalysisUsage(AnalysisUsage &AU)
          const {</div>
        <div>      AU.addRequired<DominatorTree>();</div>
        <div>    }</div>
        <div>    virtual bool runOnFunction(Function &F) {</div>
        <div>      DominatorTree& DT =
          getAnalysis<DominatorTree>();</div>
        <div>      BasicBlock* BB = DT.getRoot();</div>
        <div>      return false;</div>
        <div>    }</div>
        <div>  };</div>
        <div>}</div>
        <div>char Hello::ID = 0;</div>
        <div>static RegisterPass<Hello> Z("hello", "My test
          analysis", true, true);</div>
        <div><br>
        </div>
        <br>
        <div class="gmail_quote">On Fri, Apr 12, 2013 at 9:32 AM, John
          Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <div>
                <div>On 4/11/13 10:30 PM, Bill He wrote:<br>
                </div>
                <blockquote type="cite"> Hi all,
                  <div><br>
                  </div>
                  <div>I am trying to traverse a dominator tree and have
                    encountered a weird runtime exception:</div>
                  <div><br>
                  </div>
                  <div>Here's my simple code: </div>
                  <div><br>
                  </div>
                  <div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif"> 
                        virtual bool runOnFunction(Function &F) {</div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif"> 
                          DominatorTree& DT =
                      getAnalysis<DominatorTree>();</div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif"><br>
                    </div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif">  <b><font color="#ff0000">    DomTreeNode* rootNode =
                          DT.getRootNode();</font></b></div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif"> 
                          return false.</div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif">}</div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif"><br>
                    </div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif">Here's

                      the documentation page:</div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif"><a href="http://llvm.org/docs/doxygen/html/classllvm_1_1DominatorTree.html" style="color:rgb(17,85,204)" target="_blank">http://llvm.org/docs/doxygen/html/classllvm_1_1DominatorTree.html</a><br>



                    </div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif"><br>
                    </div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif">And

                      here's my runtime exception:</div>
                    <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif">
                      <div>dyld: lazy symbol binding failed: Symbol not
                        found:
                        __ZN4llvm17DominatorTreeBaseINS_10BasicBlockEE11getRootNodeEv</div>
                      <div>  Referenced from:
                        /Users/weibohe/Projects/llvm/llvm/Debug+Asserts/lib/LLVMSLVN.dylib</div>
                    </div>
                  </div>
                </blockquote>
                <br>
              </div>
              How are you running your pass?  Based on the error, it
              looks like whatever tool you're using to run your pass
              doesn't have the library defining the DominatorTree code
              linked in.<br>
              <br>
              -- John T.<br>
              <br>
              <blockquote type="cite">
                <div>
                  <div>
                    <div>
                      <div style="color:rgb(34,34,34);font-size:12.800000190734863px;font-family:arial,sans-serif">
                        <div>   Expected in: flat namespace</div>
                        <div><br>
                        </div>
                        <div>dyld: Symbol not found:
                          __ZN4llvm17DominatorTreeBaseINS_10BasicBlockEE11getRootNodeEv</div>
                        <div>  Referenced from:
                          /Users/weibohe/Projects/llvm/llvm/Debug+Asserts/lib/LLVMSLVN.dylib</div>
                        <div>  Expected in: flat namespace</div>
                        <div><br>
                        </div>
                        <div>0  opt               0x0000000105f528de
                          llvm::sys::PrintStackTrace(__sFILE*) + 46</div>
                        <div>1  opt               0x0000000105f52beb
                          _ZL28PrintStackTraceSignalHandlerPv + 27</div>
                        <div>2  opt               0x0000000105f52ef9
                          _ZL13SignalHandleri + 297</div>
                        <div>3  libsystem_c.dylib 0x00007fff90d32cfa
                          _sigtramp + 26</div>
                        <div>4  libsystem_c.dylib 0xfffffffffffffff8
                          _sigtramp + 1865208600</div>
                        <div>5  libsystem_c.dylib 0x00007fff64a41948
                          _sigtramp + 3553684584</div>
                        <div>6  libdyld.dylib     0x00007fff8afe2716
                          dyld_stub_binder_ + 13</div>
                        <div>7  LLVMSLVN.dylib    0x00000001081a8040
                          void std::__destroy_aux<llvm::PassInfo
                          const**>(llvm::PassInfo const**,
                          llvm::PassInfo const**, std::__true_type) +
                          19904</div>
                        <div>8  LLVMSLVN.dylib    0x00000001081998c1
                          (anonymous
                          namespace)::DVN::runOnFunction(llvm::Function&)
                          + 65</div>
                        <div>9  opt               0x0000000105eb27b2
                          llvm::FPPassManager::runOnFunction(llvm::Function&)
                          + 434</div>
                        <div>10 opt               0x0000000105eb2a98
                          llvm::FPPassManager::runOnModule(llvm::Module&)
                          + 104</div>
                        <div>11 opt               0x0000000105eb2e9a
                          llvm::MPPassManager::runOnModule(llvm::Module&)
                          + 634</div>
                        <div> 12 opt               0x0000000105eb36ae
                          llvm::PassManagerImpl::run(llvm::Module&)
                          + 302</div>
                        <div>13 opt               0x0000000105eb3951
                          llvm::PassManager::run(llvm::Module&) + 33</div>
                        <div>14 opt               0x0000000104e4d335
                          main + 6549</div>
                        <div>15 opt               0x0000000104e3e434
                          start + 52</div>
                        <div>Stack dump:</div>
                        <div>0.<span style="white-space:pre-wrap"> </span>Program

                          arguments: opt -load
                          ../../../Debug+Asserts/lib/LLVMSLVN.dylib
                          -dvn </div>
                        <div>1.<span style="white-space:pre-wrap"> </span>Running

                          pass 'Function Pass Manager' on module
                          '<stdin>'.</div>
                        <div>2.<span style="white-space:pre-wrap"> </span>Running

                          pass 'My test analysis' on function '@main'</div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>Any idea on why this is happening? Any help
                          or suggestion is appreciated! Thanks in
                          advance.</div>
                        <div><br>
                        </div>
                        <div>Best,</div>
                        <div>Weibo</div>
                        <div><br>
                        </div>
                      </div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                  </div>
                </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>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<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><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>