<div>
                    Hello Dmitry,
                </div><div><br></div><div>First of all, thank you for your reply. Because of it, I focused in create the lib that helped me.</div><div><br></div><div>Second, I realize that actually there was one thing different between the machines: due to a more frequent use of the iMac, I have a group of environment variables that are set to my developer folder; and the $PATH is one of those.</div><div><br></div><div>Furthermore, it seems that my default compiler for OSX (llvm-gcc 4.2.1) is not able to link opt when the --enable-shared flag is used for configure, but the latest version of clang + llvm (both from the git repo) is. So, if I compile a release version of clang+llvm, and use this version to compile my development version (Debug+Asserts and with shared enabled), I can generate the libLLVM-3.1svn.dylib. Finally, I was able to run MyPass when importing this lib.</div><div><br></div><div>Oh, and just for the record, the default behavior in OSX for the linker seems to be the same as Linux with the flag rdynamic on =)</div><div><br></div><div>Thanks again,</div>
                <div><div><br></div><div>-- </div><div>Cristianno Martins</div><div>PhD Student of Computer Science</div><div>University of Campinas</div><div>cmartins@ic.unicamp.br</div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Tuesday, 20 de March de 2012 at 14:08, Dmitry N. Mikushin wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>Hi Cristianno,</div><div><br></div><div>I never worked with Mac, but maybe some general insight below still</div><div>might be helpful. First of all, this error</div><div><br></div><blockquote type="cite"><div><div>Symbol not found: __ZN4llvm17DominatorTreeBaseINS_10BasicBlockEEC1Eb</div><div>  Referenced from:</div><div>/Users/cmartins/Developer/llvm/Debug+Asserts/lib/mypass.dylib</div></div></blockquote><div><br></div><div>says something like "dlopen loaded the symbol from you dynamic</div><div>library, but this symbol in turn depends on some other function, which</div><div>is not available in this particular library or libraries it refers</div><div>to".</div><div><br></div><div>To my understanding, in Linux this may happen in two cases. First,</div><div>your shared library was not linked against its dependencies</div><div>(DominatorTreeBase is something in standard llvm passes, right? = then</div><div>try to link -lLLVM-3.1svn when building mypass.dylib). Second, in</div><div>Linux there is a special link-time flag "-rdynamic" that allows</div><div>lazily-loaded dynamic library to successfully resolve its dependency,</div><div>if the parent application has already resolved the same dependency.</div><div><br></div><div>- D.</div><div><br></div><div>2012/3/20 Cristianno Martins <<a href="mailto:cristiannomartins@gmail.com">cristiannomartins@gmail.com</a>>:</div><blockquote type="cite"><div><div>Hello everyone,</div><div><br></div><div>I'm trying to create a plugin as a dynamic loadable library for opt.</div><div>Therefore, I'm facing some interesting issues.</div><div>First, I'm running OS X Lion, and i686-apple-darwin11-llvm-gcc-4.2 (GCC</div><div>4.2.1) as my default compiler. Basically, I'm creating a</div><div>DominatorTree<BasicBlock> directly as an attribute from one of my classes.</div><div>Curiously, I'm encountering some kind of error related to "flat namespace"</div><div>(the dump from this error can be seen below).</div><div><br></div><div>Well, I have already found some emails in this list about some similar</div><div>problems, but here comes the curious part: I "fixed" this problem in my iMac</div><div>(omitting the -flat-namespace flag on Makefile.rules, and using "./configure</div><div>&& make"), where now I'm capable of load and execute my pass, but the issue</div><div>still persists when running on my MacBook (one important detail is that the</div><div>environment is fundamentally the same -- same OS version, same compilers</div><div>infrastructure, same code being compiled).</div><div><br></div><div>I've already tried to use --enable-shared as an argument for the configure</div><div>script, but I get an even worse problem here: somehow the opt executable</div><div>could not be linked (and this happens in both cases: with or without the</div><div>-flat-namespace flag).</div><div><br></div><div>Is there someone who faced this problem before? Or could I be doing</div><div>something wrong?</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>--</div><div>Cristianno Martins</div><div>PhD Student of Computer Science</div><div>University of Campinas</div><div><a href="mailto:cmartins@ic.unicamp.br">cmartins@ic.unicamp.br</a></div><div><br></div><div><br></div><div>dyld: lazy symbol binding failed: Symbol not found:</div><div>__ZN4llvm17DominatorTreeBaseINS_10BasicBlockEEC1Eb</div><div>  Referenced from:</div><div>/Users/cmartins/Developer/llvm/Debug+Asserts/lib/mypass.dylib</div><div>  Expected in: flat namespace</div><div><br></div><div>dyld: Symbol not found: __ZN4llvm17DominatorTreeBaseINS_10BasicBlockEEC1Eb</div><div>  Referenced from:</div><div>/Users/cmartins/Developer/llvm/Debug+Asserts/lib/mypass.dylib</div><div>  Expected in: flat namespace</div><div><br></div><div>0  opt               0x0000000108680cb5 _ZL15PrintStackTracePv + 53</div><div>1  opt               0x0000000108681329 _ZL13SignalHandleri + 361</div><div>2  libsystem_c.dylib 0x00007fff8c883cfa _sigtramp + 26</div><div>3  libsystem_c.dylib 0x00007fff67b6f208 _sigtramp + 18446744073091855656</div><div>4  libsystem_c.dylib 0x00007fff67b75948 _sigtramp + 18446744073091882088</div><div>5  libdyld.dylib     0x00007fff9507b716 dyld_stub_binder_ + 13</div><div>6  mypass.dylib        0x0000000109613040 global constructors keyed to a +</div><div>27056</div><div>7  mypass.dylib        0x00000001096027c5 (anonymous</div><div>namespace)::LDSCC::LDSCC(llvm::Loop*, llvm::PostDominatorTree*) + 37</div><div>8  mypass.dylib        0x0000000109601873 (anonymous</div><div>namespace)::MyPass::runOnLoop(llvm::Loop*, llvm::LPPassManager&) + 531</div><div>9  opt               0x00000001082f44a6</div><div>llvm::LPPassManager::runOnFunction(llvm::Function&) + 1254</div><div>10 opt               0x00000001085e2561</div><div>llvm::FPPassManager::runOnFunction(llvm::Function&) + 497</div><div>11 opt               0x00000001085e28cd</div><div>llvm::FPPassManager::runOnModule(llvm::Module&) + 125</div><div>12 opt               0x00000001085e2b52</div><div>llvm::MPPassManager::runOnModule(llvm::Module&) + 546</div><div>13 opt               0x00000001085e32ac</div><div>llvm::PassManagerImpl::run(llvm::Module&) + 172</div><div>14 opt               0x00000001085e34e1</div><div>llvm::PassManager::run(llvm::Module&) + 33</div><div>15 opt               0x0000000107f8321f main + 6975</div><div>16 opt               0x0000000107f719d4 start + 52</div><div>17 opt               0x0000000000000006 start + 18446744069280949862</div><div>Stack dump:</div><div>0. Program arguments: ../llvm/Debug+Asserts/bin/opt -load</div><div>../llvm/Debug+Asserts/lib/mypass.dylib -mypass -debug main.bc</div><div>1. Running pass 'Function Pass Manager' on module 'main.bc'.</div><div>2. Running pass 'Loop Pass Manager' on function '@main'</div><div>3. Running pass 'MyPass Pass' on basic block '%while.cond'</div><div>Segmentation fault: 11</div><div><br></div><div><br></div><div><br></div><div>_______________________________________________</div><div>LLVM Developers mailing list</div><div>LLVMdev@cs.uiuc.edu         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a></div><div><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></div></blockquote></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>