<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">I believe the correct way is actually include the Interpreter’s header and the rest is handled automatically. Should be similar for MCJIT<br><br><div id="AppleMailSignature">Zhang</div><div><br>On 11 May 2018, at 05:21, Aaron via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Ok. I figured out. Following methods needs to be called. That fixed the issue.<div><br></div><div><div><font face="monospace, monospace">llvm::InitializeNativeTarget();</font></div><div><font face="monospace, monospace">LLVMInitializeNativeAsmPrinter();</font></div><div><font face="monospace, monospace">LLVMInitializeNativeAsmParser();</font></div><div><font face="monospace, monospace">LLVMLinkInMCJIT();</font></div></div><div><br></div><div>Aaron<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 10, 2018 at 8:33 PM, Aaron <span dir="ltr"><<a href="mailto:acraft@gmail.com" target="_blank">acraft@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>When I try to create execution engine I do get "<b style="font-size:13px;color:rgb(0,0,0);font-family:Menlo">Interpreter has not been linked in.</b>" error and EngineBuilder returns NULL.</div><div><br></div><div>Here is the line I use to create execution engine:</div><div><br></div><div><div><font face="monospace, monospace">auto executionEngine = llvm::EngineBuilder(std::move(<wbr>m_module)).setErrorStr(&error)<wbr>.create();</font></div></div><div><br></div><div>Here are all headers I have included:<br></div><div><br></div><div><div>#include "llvm/ADT/STLExtras.h"</div><div>#include "llvm/ExecutionEngine/<wbr>ExecutionEngine.h"</div><div>#include "llvm/ExecutionEngine/<wbr>GenericValue.h"</div><div>#include "llvm/IR/Argument.h"</div><div>#include "llvm/IR/BasicBlock.h"</div><div>#include "llvm/IR/Constants.h"</div><div>#include "llvm/IR/DerivedTypes.h"</div><div>#include "llvm/IR/Function.h"</div><div>#include "llvm/IR/IRBuilder.h"</div><div>#include "llvm/IR/Instructions.h"</div><div>#include "llvm/IR/LLVMContext.h"</div><div>#include "llvm/IR/Module.h"</div><div>#include "llvm/IR/Type.h"</div><div>#include "llvm/IR/Verifier.h"</div><div>#include "llvm/Support/Casting.h"</div><div>#include "llvm/Support/ManagedStatic.h"</div><div>#include "llvm/Support/TargetSelect.h"</div><div>#include "llvm/Support/raw_ostream.h"</div></div><div><br></div><div><br></div><div>And here is the simple IR code that I'm trying to JIT compile and execute in memory:</div><div><br></div><div><div><font face="monospace, monospace">; ModuleID = 'Program'</font></div><div><font face="monospace, monospace">source_filename = "Program"</font></div><div><font face="monospace, monospace"><br></font></div><div><span style="font-family:monospace,monospace">define i32 @fib(i32) {</span><br></div><div><font face="monospace, monospace">entry:</font></div><div><font face="monospace, monospace">  %i = alloca i32</font></div><div><font face="monospace, monospace">  store i32 %0, i32* %i</font></div><div><font face="monospace, monospace">  ret i32* %i</font></div><div><font face="monospace, monospace">}</font></div></div><div><br></div><div><br></div><div><div>Could someone please tell the reason and how I can resolve this?</div></div><div><br></div><div>Thanks for helping!</div><div><br></div><div>Best,</div><div><br></div><div>Aaron</div><div><br></div></div>
</blockquote></div><br></div>

</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>LLVM Developers mailing list</span><br><span><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a></span><br><span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></span><br></div></blockquote></body></html>