Internal LLVM syntax errors when following Pass tutorial using CMake -
i attempting follow tutorial here developing "hello, world" llvm pass - using guidelines linked tutorial here doing out of llvm source directory. however, when attempt follow tutorial, cmake reports number of errors internal llvm itself.
i have following directory structure:
helloworld/ cmakelists.txt helloworld/ cmakelists.txt helloworld.cpp
my helloworld.cpp
, , 2 cmakelists.txt
copy , pasted directly tutorials linked above.
i run cmake helloworld
, generates cmake configuration. however, when run make
. numerous errors reported within llvm codebase itself.
[ 50%] building cxx object cmakefiles/llvmpassname.dir/vectorize.cpp.o in file included /volumes/andromeda/helloworld/helloworld.cpp:1: in file included /usr/local/cellar/llvm/3.6.2/include/llvm/pass.h:377: in file included /usr/local/cellar/llvm/3.6.2/include/llvm/passsupport.h:27: in file included /usr/local/cellar/llvm/3.6.2/include/llvm/passregistry.h:20: in file included /usr/local/cellar/llvm/3.6.2/include/llvm-c/core.h:18: in file included /usr/local/cellar/llvm/3.6.2/include/llvm-c/support.h:17: /usr/local/cellar/llvm/3.6.2/include/llvm/support/datatypes.h:57:3: error: "must #define __stdc_limit_macros before #including support/datatypes.h" # error "must #define __stdc_limit_macros before #including support/datatypes.h" ^ /usr/local/cellar/llvm/3.6.2/include/llvm/support/datatypes.h:61:3: error: "must #define __stdc_constant_macros before " "#including support/datatypes.h" # error "must #define __stdc_constant_macros before " \
the list goes on , on , of them refer errors in llvm header files. clean install of llvm using homebrew. linking work, had set cplus_include_path
homebrew include directory llvm.
my first thought cmake attempting use different compiler (clang vs. gcc or vice versa), setting cmake_cxx_compiler
point either clang
or g++
installation did not help.
does have ideas might problem here?
after following link provided @oak in comments, able rid of first 2 support/datatype errors. however, many of errors still remain.
in file included /usr/local/cellar/llvm/3.6.2/include/llvm/pass.h:377: in file included /usr/local/cellar/llvm/3.6.2/include/llvm/passsupport.h:27: in file included /usr/local/cellar/llvm/3.6.2/include/llvm/passregistry.h:21: /usr/local/cellar/llvm/3.6.2/include/llvm/adt/densemap.h:543:63: error: space required between consecutive right angle brackets (use '> >') typename buckett = detail::densemappair<keyt, valuet>> ^ /usr/local/cellar/llvm/3.6.2/include/llvm/adt/densemap.h:694:63: error: space required between consecutive right angle brackets (use '> >') typename buckett = detail::densemappair<keyt, valuet>>
so, after research, turns out there inconsistency how llvm , cmake support out-of-source builds. llvm binaries built -fno-rtti
, cmake complain missing symbols unless uses -fno-rtti
when compiling llvm pass.
i fixed of troubles (including solved temporary fix proposed oak) adding set(cmake_cxx_flags "-wall -fno-rtti")
cmakelists.txt file in innermost directory.
this inspired question on stackoverflow.
Comments
Post a Comment