[llvm-dev] includes from new-built vs system libraries

bill rowe via llvm-dev llvm-dev at lists.llvm.org
Sun Apr 10 07:50:05 PDT 2016


I am working with llvm/clang on ubuntu trusty (actually running on cloud
9). trying to follow some code from the "llvm cookbook"

I downloaded llvm to opensource/llvm and clang to the tools subfolder then
ran cmake from llvm/build as
*cmake ../ -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;ARM"
-DCMAKE_CXX_FLAGS='-w -Dpage_size=4096'*

Then I ran make in the same folder which eventually completed ok.

Now, the built clang++ works but i'm having trouble with includes.  I know
I'm getting my built clang because it's 3.9 vs the system installed 3.6.

To compile source with the line '#include "llvm/IR/Verifier.h"' I run it as:
*opensource/llvm/build/bin/clang++ -Iopensource/llvm/include testinc.cpp*

it finds the first include but fails a couple of levels down looking for
'llvm/Config/llvm-config.h'.

bill2009 at ide50:~/workspace/llvm $ opensource/llvm/build/bin/clang++
-Iopensource/llvm/include testinc.cpp
In file included from testinc.cpp:2:
In file included from opensource/llvm/include/llvm/IR/Verifier.h:24:
In file included from opensource/llvm/include/llvm/ADT/StringRef.h:13:
opensource/llvm/include/llvm/Support/Compiler.h:18:10: fatal error:
'llvm/Config/llvm-config.h' file not found
#include "llvm/Config/llvm-config.h"
         ^
1 error generated.

If I look in opensource/llvm/include/llvm/Config I can see llvm-config.h
BUT if I look in opensource/llvm/include/llvm/IR I do NOT see verifier.h

I have to think it is somehow getting verifier.h from the system library
but I'm lost as to why and as to why it doesn't find llvm-config.h

I apologize for the long question and the confusing directory paths.
I would clean it up but make takes forever to run.

The cmake output follows in case it's useful.

bill2009 at ide50:~/workspace/llvm/opensource/llvm/build $ cmake ../
-DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;ARM"
-DCMAKE_CXX_FLAGS='-w -Dpage_size=4096'
-- Target triple: x86_64-unknown-linux-gnu
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Sphinx disabled.
-- Go bindings enabled.
-- Could NOT find OCaml (missing:  OCAMLFIND OCAML_VERSION
OCAML_STDLIB_PATH)
-- Could NOT find OCaml (missing:  OCAMLFIND OCAML_VERSION
OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- Building with -fPIC
-- Constructing LLVMBuild project information
-- Targeting X86
-- Targeting ARM
-- Clang version: 3.9.0
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/ubuntu/workspace/llvm/opensource/llvm/build
bill2009 at ide50:~/workspace/llvm/opensource/llvm/build $make
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160410/aa712cf3/attachment.html>


More information about the llvm-dev mailing list