[cfe-dev] building the example plugin "PrintFunctionNames"

Tim Northover via cfe-dev cfe-dev at lists.llvm.org
Wed Nov 6 02:28:51 PST 2019


Hi Onur,

On Wed, 6 Nov 2019 at 09:32, Onur Kulaksizoglu via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> Both the github readme and the tutorial mentions "make" to build the
> plugin as a first step, but there is no makefile in the folder and I'm
> confused about how to build the project.

They assume you've already run CMake, since that's what's used to
build all of LLVM & Clang.

> When I run cmake for the folder it doesn't work because things like
> "add_llvm_library" are not defined.

Similarly, they assume you've run CMake in a "normal" manner, as none
of the CMakeLists.txt files are self-contained. Eventually they're all
relative to llvm's top-level file.

> When I install Clang with CMake and make install, I again didn't see a
> ".so" file as mentioned in the tutorials.

Yes, examples don't get installed normally since they're not for
end-user consumption. However, you are very close; if you've built
Clang you should have a "PrintFunctionNames" target for make (i.e. you
can run "make PrintFunctionNames"). For me that creates
lib/PrintFunctionNames.so in the build directory.

Cheers.

Tim.



More information about the cfe-dev mailing list