LLVM:'第一功能'教程不适合我

时间:2014-05-20 15:01:05

标签: llvm

我正在使用Ubuntu 13.10 64位操作系统。 我已经下载并使用make构建了LLVM 3.4。 编译器:gcc 4.8.1 Shell:zsh

在配置过程中,使用了默认前缀/usr/local/。我没有使用任何其他自定义选项。

源代码和构建位于我的主文件夹中:

~/llvm_workdir/build
~/llvm_workdir/llvm

当我尝试First Function tutorial时,我面临一系列问题。第一个问题与它们在源树中进行了一些更改这一事实有关。他们在IR目录中移动了一些头文件(例如Function.h)。 (该教程适用于llvm的2.4版本。)我更正了教程源代码文件中的包含,并且出现了新的错误。第一类是这样的:

1]
zsh: command not found: llvm-config : I'm using the `zsh shell`, which is compatible with bash.

2]
In file included from /usr/include/llvm/Support/type_traits.h:20:0,
from /usr/include/llvm/ADT/StringRef.h:13,
from /usr/include/llvm/PassRegistry.h:20,
from /usr/include/llvm/PassSupport.h:26,
from /usr/include/llvm/Pass.h:366,
from /usr/include/llvm/PassManager.h:20,
from tut1_first_function.cpp:6:
/usr/include/llvm/Support/DataTypes.h:49:3: **error: #error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"**
^
/usr/include/llvm/Support/DataTypes.h:53:3: error: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
 # error "Must #define __STDC_CONSTANT_MACROS before " \

3]
In file included from /usr/include/llvm/ADT/SmallVector.h:19:0,
from /usr/include/llvm/PassAnalysisSupport.h:22,
from /usr/include/llvm/Pass.h:367,
from /usr/include/llvm/PassManager.h:20,
from tut1_first_function.cpp:6:
/usr/include/llvm/Support/MathExtras.h: In function ‘bool llvm::isInt(int64_t)’:
/usr/include/llvm/Support/MathExtras.h:259:33: **error: there are no arguments to ‘INT64_C’ that depend on a template parameter, so a declaration of ‘INT64_C’ must be available [-fpermissive]
return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));**

第二类与内部某些方法中的签名更改有关:

tut1_first_function.cpp:44:26: note: candidate is:
In file included from /usr/include/llvm/IR/GlobalValue.h:22:0,
from /usr/include/llvm/IR/Function.h:25,
from /usr/include/llvm/IR/Module.h:19,
from tut1_first_function.cpp:7:
/usr/include/llvm/IR/DerivedTypes.h:58:23: note: static llvm::IntegerType* **llvm::IntegerType::get(llvm::LLVMContext&, unsigned int)
static IntegerType *get(LLVMContext &C, unsigned NumBits);
                       ^
/usr/include/llvm/IR/DerivedTypes.h:58:23: note:   candidate expects 2 arguments, 1 provided**

我不知道要传入的其他参数是什么。我是LLVM的新手,我现在开始学习它。我还没有发现任何与新LLVM版本相对应的新教程。

如何解决上述问题?有解决方法吗?

1 个答案:

答案 0 :(得分:1)

LLVM正在积极开发中。尝试将编写到2.4版本的教程 - 超过5年 - 应用到最新版本将是一个令人沮丧的教训。

The Kaleidoscope tutorial是最新版本,通常会在新版本中保持这种状态,因此我建议您使用它。特别是,lesson 3看起来涵盖了您链接的网页中的主题。