[cfe-users] question about building
I'm new to LLVM and also new to Cmake. I've checked out multiple LLVM projects including clang (see below for list of projects checked out). I made the build directory. My question has three possible answers - A,B, or C, but if the answer is neither of those 3 can you please describe in detail what the correct answer is. My question is this, "Can I run cmake (A) with the path ONLY to the root of the LLVM project to build ALL of the projects I checked out, or (B) do I have to supply the path to the root of all the projects I checked out to cmake at once, or (C) do I run cmake multiple times in succession with a new path each time to the respective project I am building" Thank you in advance #. Checkout LLVM: * ``cd where-you-want-llvm-to-live`` * ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm`` #. Checkout Clang: * ``cd where-you-want-llvm-to-live`` * ``cd llvm/tools`` * ``svn co http://llvm.org/svn/llvm-project/cfe/trunk clang`` #. Checkout LLD linker **[Optional]**: * ``cd where-you-want-llvm-to-live`` * ``cd llvm/tools`` * ``svn co http://llvm.org/svn/llvm-project/lld/trunk lld`` #. Checkout Polly Loop Optimizer **[Optional]**: * ``cd where-you-want-llvm-to-live`` * ``cd llvm/tools`` * ``svn co http://llvm.org/svn/llvm-project/polly/trunk polly`` #. Checkout Compiler-RT (required to build the sanitizers) **[Optional]**: * ``cd where-you-want-llvm-to-live`` * ``cd llvm/projects`` * ``svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt`` #. Checkout Libomp (required for OpenMP support) **[Optional]**: * ``cd where-you-want-llvm-to-live`` * ``cd llvm/projects`` * ``svn co http://llvm.org/svn/llvm-project/openmp/trunk openmp`` #. Checkout libcxx and libcxxabi **[Optional]**: * ``cd where-you-want-llvm-to-live`` * ``cd llvm/projects`` * ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx`` * ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi`` ___ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
[cfe-users] can't find binary/executable
Hi, my exact question is in paragraph numbered 3 below. The first two paragraphs have prefatory information. 1. I ran the following command to build llvm and clang (with the intention of building the examples), `sudo cmake -DLLVM_BUILD_EXAMPLES=1 -DCLANG_BUILD_EXAMPLES=1 -DCMAKE_BUILD_TYPE="Release" ../llvm` 2. After it completed, I ran `make` and `make install`. The output from `make install` showed this (for the PrintFunctions example in /clang/examples) [ 92%] Built target PrintFunctionNames_exports [ 92%] Built target PrintFunctionNames -- Installing: /usr/local/lib/PrintFunctionNames.so 3. Question: is there a step I need to do to run the PrintFunctionNames example? I can't find a binary/executable? 4. In the directory build/tools/clang/examples, I have this analyzer-plugin clang-interpreter CMakeFiles PrintFunctionNames AnnotateFunctions cmake_install.cmake Makefile 5. In build/tools/clang/examples/PrintFunctionNames/ I have this cmake_install.cmake Makefile CMakeFiles PrintFunctionNames.exports ___ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] can't find binary/executable
Update, Sorry about that I found the instructions in the ReadMe for the PrintFunctionsDir, but they don't seem to be update or I'm running them wrong. The ReadMe says the following: "This is a simple example demonstrating how to use clang's facility for providing AST consumers using a plugin. Build the plugin by running `make` in this directory. Once the plugin is built, you can run it using: -- Linux: $ clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so -plugin print-fns some-input-file.c $ clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so -plugin print-fns -plugin-arg-print-fns help -plugin-arg-print-fns --example-argument some-input-file.c $ clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so -plugin print-fns -plugin-arg-print-fns -an-error some-input-file.c" My ".so" file is /usr/local/lib/PrintFunctionNames.so Whether I run clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so -plugin print-fns hello.c or clang -cc1 -load /usr/local/lib/PrintFunctionNames.so -plugin print-fns hello.c I get this output error: unable to load plugin '../../Debug+Asserts/lib/libPrintFunctionNames.so': 'Service unavailable' On Fri, Apr 21, 2017 at 9:50 AM, Michael Mitchell < michaeljohnmitch...@gmail.com> wrote: > Hi, > my exact question is in paragraph numbered 3 below. The first two > paragraphs have prefatory information. > > 1. I ran the following command to build llvm and clang (with the intention > of building the examples), > > `sudo cmake -DLLVM_BUILD_EXAMPLES=1 -DCLANG_BUILD_EXAMPLES=1 > -DCMAKE_BUILD_TYPE="Release" ../llvm` > > 2. After it completed, I ran `make` and `make install`. The output from > `make install` showed this (for the PrintFunctions example in > /clang/examples) > > [ 92%] Built target PrintFunctionNames_exports > > [ 92%] Built target PrintFunctionNames > > -- Installing: /usr/local/lib/PrintFunctionNames.so > > 3. Question: is there a step I need to do to run the PrintFunctionNames > example? I can't find a binary/executable? > > 4. In the directory build/tools/clang/examples, I have this > > analyzer-plugin > clang-interpreter > CMakeFiles > PrintFunctionNames > AnnotateFunctions > cmake_install.cmake > Makefile > > > 5. In build/tools/clang/examples/PrintFunctionNames/ I have this > > cmake_install.cmake > Makefile > CMakeFiles > PrintFunctionNames.exports > > > ___ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] can't find binary/executable
Problems been solved. For anyone else with the same question, the problem was that I wasn't using the clang that I had built the file against (clang came installed by default on the system). When I ran ./build/bin/clang and followed the instructions at this tutorial it worked fine https://clang.llvm.org/docs/ClangPlugins.html On Fri, Apr 21, 2017 at 10:07 AM, Michael Mitchell < michaeljohnmitch...@gmail.com> wrote: > Update, > > Sorry about that I found the instructions in the ReadMe for the > PrintFunctionsDir, but they don't seem to be update or I'm running them > wrong. The ReadMe says the following: > > "This is a simple example demonstrating how to use clang's facility for > providing AST consumers using a plugin. > > Build the plugin by running `make` in this directory. > > Once the plugin is built, you can run it using: > -- > Linux: > $ clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so > -plugin print-fns some-input-file.c > $ clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so > -plugin print-fns -plugin-arg-print-fns help -plugin-arg-print-fns > --example-argument some-input-file.c > $ clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so > -plugin print-fns -plugin-arg-print-fns -an-error some-input-file.c" > > My ".so" file is /usr/local/lib/PrintFunctionNames.so > > Whether I run > clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so -plugin > print-fns hello.c > > or > clang -cc1 -load /usr/local/lib/PrintFunctionNames.so -plugin print-fns > hello.c > > I get this output > > error: unable to load plugin > '../../Debug+Asserts/lib/libPrintFunctionNames.so': > 'Service unavailable' > > > On Fri, Apr 21, 2017 at 9:50 AM, Michael Mitchell < > michaeljohnmitch...@gmail.com> wrote: > >> Hi, >> my exact question is in paragraph numbered 3 below. The first two >> paragraphs have prefatory information. >> >> 1. I ran the following command to build llvm and clang (with the >> intention of building the examples), >> >> `sudo cmake -DLLVM_BUILD_EXAMPLES=1 -DCLANG_BUILD_EXAMPLES=1 >> -DCMAKE_BUILD_TYPE="Release" ../llvm` >> >> 2. After it completed, I ran `make` and `make install`. The output from >> `make install` showed this (for the PrintFunctions example in >> /clang/examples) >> >> [ 92%] Built target PrintFunctionNames_exports >> >> [ 92%] Built target PrintFunctionNames >> >> -- Installing: /usr/local/lib/PrintFunctionNames.so >> >> 3. Question: is there a step I need to do to run the PrintFunctionNames >> example? I can't find a binary/executable? >> >> 4. In the directory build/tools/clang/examples, I have this >> >> analyzer-plugin >> clang-interpreter >> CMakeFiles >> PrintFunctionNames >> AnnotateFunctions >> cmake_install.cmake >> Makefile >> >> >> 5. In build/tools/clang/examples/PrintFunctionNames/ I have this >> >> cmake_install.cmake >> Makefile >> CMakeFiles >> PrintFunctionNames.exports >> >> >> > ___ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users