问题描述
我遵循了 http://llvm.org/docs/GettingStarted.html 中的以下内容-已成功完成:
I followed the below from http://llvm.org/docs/GettingStarted.html - which completed successfully:
cd where-you-want-llvm-to-live
get the code
...
make
我将它们放在主目录中,所以我的结构看起来像
I put these in my home directory, so my structure looks like
~/llvmHome/llvm/<souce code is here>
~/llvmHome/build/Debug+Asserts/bin/<clang++ executables etc are here>
我正在尝试按照 http://llvm.org/docs/tutorial上的步骤进行操作/LangImpl3.html 构建示例.
I'm attempting to follow the steps on http://llvm.org/docs/tutorial/LangImpl3.html to build the example.
我在表演
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
这会发出警告,直到第一个错误为止
This gives warnings, and up to the first error
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 ++进行编译,尝试这样做
Some examaples suggest using g++ to compile, trying that gives
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
我不确定如何进一步调试,关于我变得不正确的任何想法?
I'm not sure how how to debug this further, any ideas on what I'm getting incorrect?
我应该链接到〜/llvmHome/build/下的库,而不是链接到源代码吗?
Should I be linking to libraries under ~/llvmHome/build/ instead of into the source code?
推荐答案
LLVM(和clang)最近切换到了C ++11.因此,您需要具有合理的编译器(例如clang或gcc 4.7+)并使用-std编译所有内容= c ++ 11标志.
LLVM (and clang) recently switched to C++ 11. So, you need to have reasonable compiler (e.g. clang or gcc 4.7+) and compile everything with -std=c++11 flag.
这篇关于构建llvm示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!