Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including llvm, Value.h not found

Tags:

macos

llvm

I'm trying to compile a program using llvm, following this tutorial, writing a toy compiler, but when I try to compile I keep getting a

'fatal error: 'llvm/Value.h' file not found'

I'm using llvm-config --cxxflags, and it's providing the compiler with the directory

-I/usr/local/Cellar/llvm/3.5.0/include

for the includes. Value.h appears to actualy be in the directory

/usr/local/Cellar/llvm/3.5.0/include/IR, 

but if i add the IR in the include, then a missing header just pops up in a different file.

If it helps, the full llvm-config command i'm using is,

llvm-config --libs core jit native --cxxflags --ldflags

and it's output is,

-I/usr/local/Cellar/llvm/3.5.0/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3  -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fno-common -Woverloaded-virtual -Wcast-qual
-L/usr/local/Cellar/llvm/3.5.0/lib
-lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMJIT -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport

I'm using osx 10.9.5 and llvm 3.5 installed with homebrew.

Any advice would be much appreciated, thanks.

like image 542
George Roger Avatar asked Oct 07 '14 23:10

George Roger


1 Answers

I had this same issue going through the same tutorial. Here's how I fixed it on Ubuntu 14.04:

  1. From the root directory I searched for the Value.h file.

    $ sudo find . -name Value.h
    ./usr/include/llvm-3.4/llvm/IR/Value.h
    ./usr/lib/llvm-3.4/include/lldb/Core/Value.h
    
  2. I changed the include statement in the node.h file to

    #include <llvm/IR/Value.h>
    
like image 72
tn3rt Avatar answered Nov 08 '22 18:11

tn3rt