<div dir="ltr"><div><div>Oh I see now.<br><br></div>Thank you Sergey your suggestion made the trick.<br><br></div><div>Cheers,<br></div>Alberto<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 10, 2014 at 2:15 PM, Sergey Dmitrouk <span dir="ltr"><<a href="mailto:sdmitrouk@accesssoftek.com" target="_blank">sdmitrouk@accesssoftek.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry for the wrong suggestion. I built your project and the library is<br>
about 17 MiB as it includes LLVM libraries statically linked to it. opt<br>
has same libraries, same global variables that define command-line<br>
categories, which causes raising of the assertion. If I comment out<br>
<br>
target_link_libraries(Test ${REQ_LLVM_LIBS})<br>
<br>
in pass/CMakeLists.txt, so file is about 27 KiB and prints function<br>
names just as expected.<br>
<br>
Cheers,<br>
Sergey<br>
<div class=""><br>
On Sun, Aug 10, 2014 at 05:42:30AM -0700, Alberto Magni wrote:<br>
> Hello Sergey,<br>
><br>
> thanks for the suggestion.<br>
> The name of the pass is not what triggers the assertion.<br>
> The test case I attached to the email is a stripped-down version of a much<br>
> more complicated pass<br>
> (with a proper name) that originally caused the problem.<br>
><br>
> Also, to be sure, I just tried to change the name of the pass to something<br>
> more significant.<br>
> It did not work.<br>
> Cheers,<br>
> Alberto<br>
><br>
> On Sun, Aug 10, 2014 at 1:14 PM, Sergey Dmitrouk<br>
> <<a href="mailto:sdmitrouk@accesssoftek.com">sdmitrouk@accesssoftek.com</a>> wrote:<br>
><br>
> Hi Alberto,<br>
><br>
> See [0], first argument of RegisterPass' constructor is argument name.<br>
> Try changing it to something more unique than "test", I guess it might<br>
> cause your issue.<br>
><br>
> Regards,<br>
> Sergey<br>
><br>
> [0]:<br>
> <a href="http://www.llvm.org/docs/doxygen/html/structllvm_1_1RegisterPass.html" target="_blank">http://www.llvm.org/docs/doxygen/html/structllvm_1_1RegisterPass.html</a><br>
> On Sat, Aug 09, 2014 at 08:48:00AM -0700, Alberto Magni wrote:<br>
</div>> > A A Hi all,<br>
> ><br>
> > A A I am trying to create an out-of-tree LLVM project.<br>
> ><br>
> > A A I have written a Test project following the guide in [1] that<br>
> triggers the<br>
> > A A problem.<br>
> ><br>
> > A A Pass body is in [2].<br>
> > A A The CMakeLists.txt file for the "root" directory is in [3]<br>
> > A A The CMakeLists.txt file for the "pass" directory is in [4]<br>
> ><br>
> > A A When I run opt --load=libTest.so<br>
> > A A I trigger the following assertion:<br>
> ><br>
> > A A opt: CommandLine.cpp:134: void<br>
> > A A llvm::cl::OptionCategory::registerCategory(): Assertion<br>
> > A A `std::count_if(RegisteredOptionCategories->begin(),<br>
> > A A RegisteredOptionCategories->end(), [this](const OptionCategory<br>
> *Category)<br>
> > A A { return getName() == Category->getName(); }) == 0 && "Duplicate<br>
> option<br>
> > A A categories"' failed.<br>
> ><br>
> > A A Note that my pass does not even define any command line option.<br>
> ><br>
> > A A I am using LLVM 3.5 git fa840e7dfb9115a3ac9891d898e7fe2543c65948<br>
> > A A gcc 4.8.1<br>
> > A A cmake 2.8.11<br>
> ><br>
> > A A Am I doing anything wrong in the project setup ?<br>
> > A A Any help is appreciated.<br>
> ><br>
> > A A Cheers,<br>
> > A A Alberto<br>
> ><br>
> > A A [1]<br>
> <a href="http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project" target="_blank">http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project</a><br>
> > A A [2]<br>
> <a href="https://gist.github.com/HariSeldon/9a310312a4e1a0039483#file-test-cpp" target="_blank">https://gist.github.com/HariSeldon/9a310312a4e1a0039483#file-test-cpp</a><br>
> > A A [3]<br>
> > A<br>
> A <a href="https://gist.github.com/HariSeldon/d979d38cf8ee52d9d134#file-cmakelists-txt" target="_blank">https://gist.github.com/HariSeldon/d979d38cf8ee52d9d134#file-cmakelists-txt</a><br>
> > A A [4]<br>
> > A<br>
> A <a href="https://gist.github.com/HariSeldon/5f60a6bf6b28617593f2#file-cmakelists-txt" target="_blank">https://gist.github.com/HariSeldon/5f60a6bf6b28617593f2#file-cmakelists-txt</a><br>
</blockquote></div><br></div>