Проблемы с компиляцией с LLVM ORC JIT

Я собираю дерево, чтобы скомпилировать примеры LLVM ORC JIT. Но я застрял в некоторых проблемах, которые не могу решить самостоятельно.

Во-первых, я компилирую с C ++ 14 с последним стабильным LLVM и clang, это означает 4.0.1. Я получаю следующую ошибку. Я пропустил какой-то конкретный вариант компиляции?

Компиляция выглядит вот так.

Compiling contribJIT.cpp
PWD:  /home/ikuehl/projects-llvm/TurboLisp/domainEngineer  Source file: contribJIT  Source file type:  cpp  source sub-folder:  src/contrib  Compiler:  /usr/local/bin/clang++ COMPILE_FLAG option:  -v -g0 -fPIC -fno-use-cxa-atexit -emit-llvm -I/usr/local/include -I/opt/BOOST/include -std=c++14 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS  LLVM_CONFIG_COMPILE option:  -I/usr/local/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  option:  -emit-llvm  sub-path:  contrib  lto:  -flto=thin -O3

if test "contrib" = "contrib/parser"; then cd bin/x86_64/contrib; `/usr/local/bin/clang++ -emit-llvm -c -v -g0 -fPIC -fno-use-cxa-atexit -emit-llvm -I/usr/local/include -I/opt/BOOST/include -std=c++14 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS ../../../src/contrib/'contribJIT'.'cpp' -o 'contribJIT'.o `/usr/local/bin/llvm-config --cppflags``; cd ..; else cd bin/x86_64/contrib; `/usr/local/bin/clang++ -emit-llvm -c -v -g0 -fPIC -fno-use-cxa-atexit -emit-llvm -I/usr/local/include -I/opt/BOOST/include -std=c++14 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS ../../../src/contrib/'contribJIT'.'cpp' -o 'contribJIT'.o `/usr/local/bin/llvm-config --cppflags``; cd ..; fi
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/usr/local/bin/clang-4.0" -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -emit-llvm-uselists -disable-free -main-file-name contribJIT.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /home/ikuehl/projects-llvm/TurboLisp/domainEngineer/bin/x86_64/contrib/contribJIT.gcno -resource-dir /usr/local/bin/../lib/clang/4.0.1 -I /usr/local/include -I /opt/BOOST/include -D __STDC_CONSTANT_MACROS -D __STDC_LIMIT_MACROS -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward -internal-isystem /usr/local/include -internal-isystem /usr/local/bin/../lib/clang/4.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /home/ikuehl/projects-llvm/TurboLisp/domainEngineer/bin/x86_64/contrib -ferror-limit 19 -fmessage-length 237 -fno-use-cxa-atexit -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o contribJIT.o -x c++ ../../../src/contrib/contribJIT.cpp
clang -cc1 version 4.0.1 based upon LLVM 4.0.1 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0"ignoring duplicate directory "/usr/local/include"as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
/opt/BOOST/include
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward
/usr/local/include
/usr/local/bin/../lib/clang/4.0.1/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.

Ошибка, которую я получаю, такова:

ошибка: неизвестное имя типа ‘RTDyldObjectLinkingLayer’; ты имел ввиду
‘RTDyldObjectLinkingLayerBase’?

Более того, я получаю больше ошибок. Это говорит мне, что что-то не так с шаблонами.

ошибка: слишком много аргументов шаблона для шаблона класса ‘IRCompileLayer’
IRCompileLayer CompileLayer;

Еще одна ошибка в отношении RTDyldObjectLinkingLayer:

ошибка: слишком много аргументов шаблона для шаблона класса ‘IRCompileLayer’
IRCompileLayer CompileLayer;

#define _CONTRIB_JIT_ 1

#include "llvm/ADT/STLExtras.h"#include "llvm/ExecutionEngine/ExecutionEngine.h"#include "llvm/ExecutionEngine/JITSymbol.h"#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"#include "llvm/ExecutionEngine/SectionMemoryManager.h"#include "llvm/ExecutionEngine/Orc/CompileUtils.h"#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"#include "llvm/ExecutionEngine/Orc/LambdaResolver.h"#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/Mangler.h"#include "llvm/Support/DynamicLibrary.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Target/TargetMachine.h"#include <algorithm>
#include <memory>
#include <string>
#include <vector>

using namespace llvm;
using namespace llvm::orc;

namespace tl {
namespace contrib {

class GenericJIT {

private:
std::unique_ptr<TargetMachine> TM;
const DataLayout DL;
RTDyldObjectLinkingLayer ObjectLayer;
IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;

public:
using ModuleHandle = decltype(CompileLayer)::ModuleSetHandleT;

GenericJIT()
: TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
ObjectLayer([]() { return std::make_shared<SectionMemoryManager>(); }),
CompileLayer(ObjectLayer) {
llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);
}

TargetMachine &getTargetMachine() { return *TM; }

ModuleHandle addModule(std::unique_ptr<Module> M) {
// Build our symbol resolver:
// Lambda 1: Look back into the JIT itself to find symbols that are part of
//           the same "logical dylib".
// Lambda 2: Search for external symbols in the host process.
auto Resolver = createLambdaResolver(
[&](const std::string &Name) {
if (auto Sym = CompileLayer.findSymbol(Name, false))
return Sym;
return JITSymbol(nullptr);
},
[](const std::string &Name) {
if (auto SymAddr =
RTDyldMemoryManager::getSymbolAddressInProcess(Name))
return JITSymbol(SymAddr, JITSymbolFlags::Exported);
return JITSymbol(nullptr);
});

// Add the set to the JIT with the resolver we created above and a newly
// created SectionMemoryManager.
return cantFail(CompileLayer.addModule(std::move(M),
std::move(Resolver)));
}

JITSymbol findSymbol(const std::string Name) {
std::string MangledName;
raw_string_ostream MangledNameStream(MangledName);
Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
return CompileLayer.findSymbol(MangledNameStream.str(), true);
}

void removeModule(ModuleHandle H) {
cantFail(CompileLayer.removeModule(H));
}
};

}
}

Код 1 к 1 скопирован с веб-сайта LLVM, Пример LLVM ORC JIT.

Кто-нибудь может сказать мне, что я пропустил в своем коде или в опциях компиляции?

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]