2016-07-26 42 views
4

我试图关注https://github.com/lsegal/my_toy_compiler,但即使它已更新为LLVM 3.8.0,我仍无法使用LLVM 3.8.4从brew与--with-clang --with-lld --with-jit --with-python进行编译。具体而言,我收到以下错误use of undeclared identifier 'getGlobalContext'针对LLVM的绑定3.8.4 no getGlobalContext

此外,符号getGlobalContext未出现在/usr/local/opt/llvm/include/llvm/IR/LLVMContext.h或实际上在/usr/local/opt/llvm/include目录中的任何位置。

我期望这个函数最近已被弃用(为此我一直没有找到任何证据),或者我没有正确地构建它。

任何提示将不胜感激。

注意我已经看到Trouble linking against LLVM with project including Flex and Bison,并没有解决我的具体问题

回答

1

我有从SVN内置4.0.0版本同样的问题。我已经发现了以下提交266379与去除getGlobalConfig的所有匹配()

https://reviews.llvm.org/rL266379

此提交修改例子要么限定内部上下文变量:
当时
static IRBuilder<> Builder(getGlobalContext());

成为
static LLVMContext TheContext;
static IRBuilder<> Builder(TheContext);

+0

感谢。我应该提到,我能够通过从源代码(版本3.8.something)构建最新的zip文件来解决我的问题,但这也是很好的信息。 – Mobius

3

我也遇到了与llvm 4.0相同的问题。 我的解决方案如下。

老:

LLVMContext *llvmcx; 
    llvmcx = &getGlobalContext(); 

新:

LLVMContext *llvmcx; 
static LLVMContext MyGlobalContext; 
llvmcx = &MyGlobalContext;