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