我从http://llvm.org/docs/GettingStarted.html开始遵循以下内容 - 已成功完成:
cd where-you-want-llvm-to-live
get the code
...
make
我将这些放在我的主目录中,所以我的结构看起来像
~/llvmHome/llvm/<souce code is here>
~/llvmHome/build/Debug+Asserts/bin/<clang++ executables etc are here>
我正在尝试按照http://llvm.org/docs/tutorial/LangImpl3.html上的步骤来构建示例。
我正在表演
cd ~/llvmHom/llvm/examples/Kaleidoscope/Chapter3 //so I'm where I checked out the source code
然后,我正在尝试:
~/llvmHome/build/Debug+Asserts/bin/clang++ -g -O3 toy.cpp `~/llvmHome/build/Debug+Asserts/bin/llvm-config --cppflags --ldflags --libs core` -o toy
这会发出警告,直至第一个错误
In file included from toy.cpp:1:
In file included from ~/llvmHome/llvm/include/llvm/IR/Verifier.h:24:
In file included from ~/llvmHome/llvm/include/llvm/ADT/StringRef.h:14:
~/llvmHome/llvm/include/llvm/Support/Allocator.h:82:42: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
virtual MemSlab *Allocate(size_t Size) override;
^
~/llvmHome/llvm/include/llvm/Support/Allocator.h:83:42: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
virtual void Deallocate(MemSlab *Slab) override;
^
In file included from toy.cpp:2:
In file included from ~/llvmHome/llvm/include/llvm/IR/DerivedTypes.h:21:
In file included from ~/llvmHome/llvm/include/llvm/IR/Type.h:19:
In file included from ~/llvmHome/llvm/include/llvm/ADT/APFloat.h:20:
In file included from ~/llvmHome/llvm/include/llvm/ADT/APInt.h:19:
In file included from ~/llvmHome/llvm/include/llvm/ADT/ArrayRef.h:14:
~/llvmHome/llvm/include/llvm/ADT/SmallVector.h:235:20: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
void push_back(T &&Elt) {
^
~/llvmHome/llvm/include/llvm/ADT/SmallVector.h:187:15: error: no member named 'move' in namespace 'std'; did you mean simply 'move'?
*Dest = ::std::move(*I);
^~~~~~~~~~~
move
一些examaples建议使用g ++进行编译,尝试使用
g++ -g -O3 toy.cpp `~/llvmHome/build/Debug+Asserts/bin/llvm-config --cppflags --ldflags --libs core` -o toy
In file included from ~/llvmHome/llvm/include/llvm/ADT/StringRef.h:14:0,
from ~/llvmHome/llvm/include/llvm/IR/Verifier.h:24,
from toy.cpp:1:
~/llvmHome/llvm/include/llvm/Support/Allocator.h:82:40: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 [enabled by default]
~/llvmHome/llvm/include/llvm/Support/Allocator.h:83:40: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 [enabled by default]
In file included from ~/llvmHome/llvm/include/llvm/ADT/ArrayRef.h:14:0,
from ~/llvmHome/llvm/include/llvm/ADT/APInt.h:19,
from ~/llvmHome/llvm/include/llvm/ADT/APFloat.h:20,
from ~/llvmHome/llvm/include/llvm/IR/Type.h:19,
from ~/llvmHome/llvm/include/llvm/IR/DerivedTypes.h:21,
from toy.cpp:2:
~/llvmHome/llvm/include/llvm/ADT/SmallVector.h:235:20: error: expected ‘,’ or ‘...’ before ‘&&’ token
我不知道如何进一步调试这个问题,关于我的错误的任何想法?
我应该链接到〜/ llvmHome / build /下的库而不是源代码吗?
答案 0 :(得分:1)
LLVM(和clang)最近切换到C ++ 11.所以,你需要有合理的编译器(例如clang或gcc 4.7+)并使用-std = c ++ 11 flag编译所有内容。