我遵循了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一些示例建议使用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/下面的库,而不是链接到源代码中吗?
发布于 2014-03-03 19:09:13
最近,LLVM (和clang)切换到C++ 11,因此,您需要有合理的编译器(例如clang或gcc 4.7+),并使用-std=c++11标志编译所有内容。
https://stackoverflow.com/questions/22149118
复制相似问题