EngineBuilder(std::move(Owner)).create() return null

I just copy the latest code in HowToUseJIT and run, but the EngineBuilder(std::move(Owner)).create() keeps return null, any idea why?

Here’s my CMakeList:

cmake_minimum_required(VERSION 3.12)
project(llvm_test)

set(CMAKE_CXX_STANDARD 14)

find_package(LLVM REQUIRED CONFIG)
llvm_map_components_to_libnames(llvm_libs support core irreader orcjit native)

add_executable(llvm_test main.cpp)
target_include_directories(llvm_test PUBLIC ${LLVM_INCLUDE_DIRS})
target_compile_definitions(llvm_test PUBLIC ${LLVM_DEFINITIONS})
target_link_libraries(llvm_test ${llvm_libs})

Isn’t there a method in EngineBuilder to get the error message or something?
I assume it’s you didn’t link in the JIT module

Zhang

I found a private ErrorStr member, but didn’t find the get function of this member, could you tell me how I can get the error message?

SetErrString , its argument is a pointer to a string. Use it before calling other methods and inspect it after calling Engine-Building methods

Zhang

tanks, I got the error message and it seems I need to #include “llvm/ExecutionEngine/Interpreter.h”

It depends. If you need the JIT backend(you should be since Interpreter is barely usable), you’ll need to include MCJIT Instead

Zhang