我正在尝试遵循教程
here
开发“Hello,World”LLVM通行证-我使用的是该教程链接的指南
here
用于在LLVM源目录之外执行此操作。然而,当我尝试学习本教程时,CMake报告了LLVM本身内部的一些错误。
我有以下目录结构:
HelloWorld/
CMakeLists.txt
HelloWorld/
CMakeLists.txt
HelloWorld.cpp
我的
HelloWorld.cpp
,以及这两个
CMakeLists.txt
直接从上面链接的教程中复制和粘贴。
我跑了
CMake HelloWorld
并成功生成CMake配置。然而,当我跑步时
make
我从LLVM代码库本身中报告了许多错误。
[ 50%] Building CXX object CMakeFiles/LLVMPassName.dir/Vectorize.cpp.o
In file included from /Volumes/andromeda/HelloWorld/HelloWorld.cpp:1:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/Pass.h:377:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/PassSupport.h:27:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/PassRegistry.h:20:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm-c/Core.h:18:
In file included from /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 " \
这个列表不断地出现,所有这些都引用了LLVM头文件中的错误。这是使用Homebrew的LLVM的干净安装。为了连接到工作,我必须设置
CPLUS_INCLUDE_PATH
到LLVM的Homebrew include目录。
我的第一个想法是,CMake试图使用不同的编译器(Clang与GCC或反之亦然),但是设置
CMAKE_CXX_COMPILER
指向我的
clang
或
g++
安装没有帮助。
有人对这里的问题有什么想法吗?
在遵循@oak在评论中提供的链接后,我能够消除前两个Support/DataType错误。然而,许多错误仍然存在。
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/Pass.h:377:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/PassSupport.h:27:
In file included from /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: a space is 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: a space is required
between consecutive right angle brackets (use '> >')
typename BucketT = detail::DenseMapPair<KeyT, ValueT>>