(no subject)


I’m not able to compile simple plugins.
I’m working on clang++.
Always facing compilation error:

undefined reference to clang::FullSourcrLoc::getSpellingLineNumber (bool*) const
^usr/lib/…/libLLVMSupport.a (Process.cpp.o): In function terminalHasColors:
*/usr/src/…/Support/Unix/Process.inc:357: undefined reference to 'setupterm* undefined reference to 'tigetnum
undefined reference to set_curterm

Linker via gcc command failed with exit code 1

Im compiling code using cmake.
My CMakeLists.txt consist of

Add_definations (-D__STD_LIMIT_MACROS
-D__STD_CONSTANT_MACROS -fno-rtti -Wall -std=c++14 -stdlib=libc++abi -O2)
Target_link_libraries (exename clang clangfrontend clangast clangtooling llvmsupport)

Dont know what am i doing wrong.

Vishal Gupta


I believe that this is caused by libterminfo. You need to link to libterminfo.

There might be other missing libs depending on the config, see the logic in llvm/lib/Support/CMakeLists.txt to initialize system_libs.

You can get the required system libraries with:

llvm-config --system-libs

I’ve found it far easier to invoke llvm-config to get the required flags than try to integrate with LLVM’s CMake packages (which are not regularly tested with out-of-tree use and frequently break), even for building a single pass as a plugin.