Hi, I try to build my clang pulgin with libclang-dev and llvm-dev, it works good when I build binary with dynamic library, but seems it can’t static build with these packages.
I use these cmake options to static build:
set(CMAKE_EXE_LINKER_FLAGS "-static") set(CMAKE_CXX_FLAGS "-static")
and I get an error said that the linker try to link dynamic library(libLLVM-13.so.1) with the “–static” option, so it fails to get an executable binary.
But when I git clone
llvm-project, and build
llvm/clang with myself, and then set
CMAKE_PREFIX_PATH=/llvm-project/build, these cmake options work good, static build is good too.
The question is:
Every time I build my clang plugin, I must build llvm-project by myself? It will take a long time. Is there any way to build clang plugin directly with just install some packages? Or is my CMakeList.txt not right? I use the same CMakeList.txt as include-what-you-use
include-what-you-use has the same problem, here are my build script.