大厦LLVM的例子(Building llvm examples)

2019-10-19 11:03发布

我跟着从下面的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 /建设/,而不是到源代码?

Answer 1:

LLVM(和铛)近日切换到C ++ 11所以,你需要有合理的编译器(如铛或GCC 4.7+)和编译-std = C ++ 11标志的一切。



文章来源: Building llvm examples
标签: llvm