19

When compiling with the experimental LLVM3.5 libraries link the following link errors appear:

/usr/lib/llvm-3.5/lib/libLLVMSupport.a(Process.o): In function llvm::sys::Process::FileDescriptorHasColors(int)': (.text+0x85b): undefined reference tosetupterm' /usr/lib/llvm-3.5/lib/libLLVMSupport.a(Process.o): In function llvm::sys::Process::FileDescriptorHasColors(int)': (.text+0x87a): undefined reference totigetnum' /usr/lib/llvm-3.5/lib/libLLVMSupport.a(Process.o): In function llvm::sys::Process::FileDescriptorHasColors(int)': (.text+0x888): undefined reference toset_curterm' /usr/lib/llvm-3.5/lib/libLLVMSupport.a(Process.o): In function llvm::sys::Process::FileDescriptorHasColors(int)': (.text+0x890): undefined reference todel_curterm'

The link command line was generated with llvm-config, so why is this failing?

Sean
  • 60,939
  • 11
  • 97
  • 136

2 Answers2

19

llvm-config is not adding the link option for the Terminfo library. Add

-ltinfo

To link in the library and all should be well.

Sean
  • 60,939
  • 11
  • 97
  • 136
  • A lot of the LLVM tutorials suggest adding `--system-libs` to the use of `llvm-config`, So I preferred the answer from @xl4times. Your answer is also correct, but I think folks linking against LLVM should make use of llvm-config. – Nick Desaulniers Dec 30 '18 at 05:26
  • I get `/usr/bin/ld: cannot find -ltinfo` – PPP Jun 18 '20 at 02:57
15

Add llvm-config --system-libs in link option

yee
  • 575
  • 5
  • 11