Target does not support MC emission

With the following call:

llvm::ExecutionEngine* engine;

llvm::EngineBuilder builder( module );

builder.setEngineKind( llvm::EngineKind::Either ); // it will use JIT if available
builder.setUseMCJIT ( true );
engine = builder.create();

These calls are successful in windows. But when I try in Linux (Ubuntu), the create() function fails with the error message:
Target does not support MC emission

Any ideas why and how to fix it?



I notice that lli.cpp calls a few EngineBuilder functions (that your snippet does not) before calling create().

You might want to try calling the setMCPU() and setMArch() functions of EngineBuilder, and if that doesn’t work, look at what else lli is initializing in the builder.

Also, are you calling InitializeNativeTarget() and InitializeNativeTargetAsmPrinter() in your startup code? In my own testing, I found that I need to call those two functions to have MCJIT work correctly.

Best of luck,