Ingmar Kühl via llvm-dev
2017-Aug-06 16:35 UTC
[llvm-dev] Compile issues with LLVM ORC JIT
I tree to compile the LLVM ORC JIT examples. But I'm stuck in some problems I can't solve my own. First at all I compile with C++14 enabled with latest stable LLVM and clang, this means 4.0.1. I get the following error. Do I missed some specific compile option? Compilation looks like this here. |CompilingcontribJIT.cpp PWD:/home/ikuehl/projects-llvm/TurboLisp/domainEngineer Sourcefile:contribJIT Sourcefile 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 iftest "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 ..;elsecd 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 Threadmodel:posix InstalledDir:/usr/local/bin Foundcandidate GCC installation:/usr/lib/gcc/x86_64-linux-gnu/6Foundcandidate GCC installation:/usr/lib/gcc/x86_64-linux-gnu/6.3.0SelectedGCC installation:/usr/lib/gcc/x86_64-linux-gnu/6.3.0Candidatemultilib:.;@m64Selectedmultilib:.;@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.1based upon LLVM 4.0.1defaulttarget 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 Endof search list.| The error I get is this: error: unknown type name 'RTDyldObjectLinkingLayer'; did you mean 'RTDyldObjectLinkingLayerBase'? Moreover, I get more errors. This tells me something is wrong with the templating. error: too many template arguments for class template 'IRCompileLayer' IRCompileLayer CompileLayer; Another error with regards to RTDyldObjectLinkingLayer: error: too many template arguments for class template '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>usingnamespacellvm;usingnamespacellvm::orc;namespacetl {namespacecontrib {classGenericJIT{private:std::unique_ptr<TargetMachine>TM;constDataLayoutDL;RTDyldObjectLinkingLayerObjectLayer;IRCompileLayer<decltype(ObjectLayer),SimpleCompiler>CompileLayer;public:usingModuleHandle=decltype(CompileLayer)::ModuleSetHandleT;GenericJIT():TM(EngineBuilder().selectTarget()),DL(TM->createDataLayout()),ObjectLayer([](){returnstd::make_shared<SectionMemoryManager>();}),CompileLayer(ObjectLayer){llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);}TargetMachine&getTargetMachine(){return*TM;}ModuleHandleaddModule(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.autoResolver=createLambdaResolver([&](conststd::string &Name){if(autoSym=CompileLayer.findSymbol(Name,false))returnSym;returnJITSymbol(nullptr);},[](conststd::string &Name){if(autoSymAddr=RTDyldMemoryManager::getSymbolAddressInProcess(Name))returnJITSymbol(SymAddr,JITSymbolFlags::Exported);returnJITSymbol(nullptr);});// Add the set to the JIT with the resolver we created above and a newly// created SectionMemoryManager.returncantFail(CompileLayer.addModule(std::move(M),std::move(Resolver)));}JITSymbolfindSymbol(conststd::string Name){std::string MangledName;raw_string_ostream MangledNameStream(MangledName);Mangler::getNameWithPrefix(MangledNameStream,Name,DL);returnCompileLayer.findSymbol(MangledNameStream.str(),true);}voidremoveModule(ModuleHandleH){cantFail(CompileLayer.removeModule(H));}};}}| The code is 1-to-1 copied from LLVM web site,LLVM ORC JIT Example <https://llvm.org/docs/tutorial/BuildingAJIT3.html>. Could anybody tell me what I missed in my code, or in compile options? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170806/c8cd010d/attachment-0001.html>
Stefan Gränitz via llvm-dev
2017-Aug-08 07:40 UTC
[llvm-dev] Compile issues with LLVM ORC JIT
Hi Ingmar What version of LLVM are you building against? Did you try building the original example from the LLVM sources in llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3?> The code is 1-to-1 copied from LLVM web site, LLVM ORC JIT Example > <https://llvm.org/docs/tutorial/BuildingAJIT3.html>.There's quite a few differences actually (namespaces, class name, include guard).> First at all I compile with C++14 enabledDid you configure your LLVM build with LLVM_ENABLE_CXX1Y=ON? It's probably not the issue here, but sticking to one set of compile options for all parts of a project saves headache.> error: too many template arguments for class template > 'IRCompileLayer' IRCompileLayer CompileLayer; > > Another error with regards to RTDyldObjectLinkingLayer: > > error: too many template arguments for class template > 'IRCompileLayer' IRCompileLayer CompileLayer; >That's two times the same ;) If you are not sure about your toolchain configuration, did you consider using CMake? Cheers Stefan Am 06.08.17 um 18:35 schrieb Ingmar Kühl via llvm-dev:> > I tree to compile the LLVM ORC JIT examples. But I'm stuck in some > problems I can't solve my own. > > First at all I compile with C++14 enabled with latest stable LLVM and > clang, this means 4.0.1. I get the following error. Do I missed some > specific compile option? > > Compilation looks like this here. > > |CompilingcontribJIT.cpp > PWD:/home/ikuehl/projects-llvm/TurboLisp/domainEngineer > Sourcefile:contribJIT Sourcefile 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 iftest > "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 ..;elsecd > 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 > Threadmodel:posix InstalledDir:/usr/local/bin Foundcandidate GCC > installation:/usr/lib/gcc/x86_64-linux-gnu/6Foundcandidate GCC > installation:/usr/lib/gcc/x86_64-linux-gnu/6.3.0SelectedGCC > installation:/usr/lib/gcc/x86_64-linux-gnu/6.3.0Candidatemultilib:.;@m64Selectedmultilib:.;@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.1based > upon LLVM 4.0.1defaulttarget 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 Endof search list.| > > The error I get is this: > > error: unknown type name 'RTDyldObjectLinkingLayer'; did you mean > 'RTDyldObjectLinkingLayerBase'? > > Moreover, I get more errors. This tells me something is wrong with the > templating. > > error: too many template arguments for class template > 'IRCompileLayer' IRCompileLayer CompileLayer; > > Another error with regards to RTDyldObjectLinkingLayer: > > error: too many template arguments for class template > '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>usingnamespacellvm;usingnamespacellvm::orc;namespacetl > {namespacecontrib > {classGenericJIT{private:std::unique_ptr<TargetMachine>TM;constDataLayoutDL;RTDyldObjectLinkingLayerObjectLayer;IRCompileLayer<decltype(ObjectLayer),SimpleCompiler>CompileLayer;public:usingModuleHandle=decltype(CompileLayer)::ModuleSetHandleT;GenericJIT():TM(EngineBuilder().selectTarget()),DL(TM->createDataLayout()),ObjectLayer([](){returnstd::make_shared<SectionMemoryManager>();}),CompileLayer(ObjectLayer){llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);}TargetMachine&getTargetMachine(){return*TM;}ModuleHandleaddModule(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.autoResolver=createLambdaResolver([&](conststd::string > &Name){if(autoSym=CompileLayer.findSymbol(Name,false))returnSym;returnJITSymbol(nullptr);},[](conststd::string > &Name){if(autoSymAddr=RTDyldMemoryManager::getSymbolAddressInProcess(Name))returnJITSymbol(SymAddr,JITSymbolFlags::Exported);returnJITSymbol(nullptr);});// > Add the set to the JIT with the resolver we created above and a > newly// created > SectionMemoryManager.returncantFail(CompileLayer.addModule(std::move(M),std::move(Resolver)));}JITSymbolfindSymbol(conststd::string > Name){std::string MangledName;raw_string_ostream > MangledNameStream(MangledName);Mangler::getNameWithPrefix(MangledNameStream,Name,DL);returnCompileLayer.findSymbol(MangledNameStream.str(),true);}voidremoveModule(ModuleHandleH){cantFail(CompileLayer.removeModule(H));}};}}| > > The code is 1-to-1 copied from LLVM web site, LLVM ORC JIT Example > <https://llvm.org/docs/tutorial/BuildingAJIT3.html>. > > Could anybody tell me what I missed in my code, or in compile options? > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- https://weliveindetail.github.io/blog/ https://cryptup.org/pub/stefan.graenitz at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170808/c54f9d68/attachment-0001.html>
Hi Ingmar, The example code (in llvm/examples/Kaleidoscope/BuildingAJIT/) should compile, but the tutorial text may be out of date after recent changes to the ORC APIs. I'm looking in to this now. Cheers, Lang. On Tue, Aug 8, 2017 at 12:40 AM, Stefan Gränitz via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi Ingmar > > What version of LLVM are you building against? > Did you try building the original example from the LLVM sources in > llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3? > > The code is 1-to-1 copied from LLVM web site, LLVM ORC JIT Example > <https://llvm.org/docs/tutorial/BuildingAJIT3.html>. > > There's quite a few differences actually (namespaces, class name, include > guard). > > First at all I compile with C++14 enabled > > Did you configure your LLVM build with LLVM_ENABLE_CXX1Y=ON? It's probably > not the issue here, but sticking to one set of compile options for all > parts of a project saves headache. > > error: too many template arguments for class template 'IRCompileLayer' > IRCompileLayer CompileLayer; > > Another error with regards to RTDyldObjectLinkingLayer: > > error: too many template arguments for class template 'IRCompileLayer' > IRCompileLayer CompileLayer; > > That's two times the same ;) > > If you are not sure about your toolchain configuration, did you consider > using CMake? > > Cheers > Stefan > > Am 06.08.17 um 18:35 schrieb Ingmar Kühl via llvm-dev: > > I tree to compile the LLVM ORC JIT examples. But I'm stuck in some > problems I can't solve my own. > > First at all I compile with C++14 enabled with latest stable LLVM and > clang, this means 4.0.1. I get the following error. Do I missed some > specific compile option? > > Compilation looks like this here. > > 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-gnuThread model: posixInstalledDir: /usr/local/binFound candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0Candidate multilib: .;@m64Selected 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/includeEnd of search list. > > The error I get is this: > > error: unknown type name 'RTDyldObjectLinkingLayer'; did you mean > 'RTDyldObjectLinkingLayerBase'? > > Moreover, I get more errors. This tells me something is wrong with the > templating. > > error: too many template arguments for class template 'IRCompileLayer' > IRCompileLayer CompileLayer; > > Another error with regards to RTDyldObjectLinkingLayer: > > error: too many template arguments for class template '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)); > } > }; > > }} > > The code is 1-to-1 copied from LLVM web site, LLVM ORC JIT Example > <https://llvm.org/docs/tutorial/BuildingAJIT3.html>. > > Could anybody tell me what I missed in my code, or in compile options? > > > _______________________________________________ > LLVM Developers mailing listllvm-dev at lists.llvm.orghttp://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > -- https://weliveindetail.github.io/blog/https://cryptup.org/pub/stefan.graenitz at gmail.com > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170810/80fffd77/attachment-0001.html>