Seg Fault when creating an execution engine

I am creating an ExecutionEngine using the LLVMCreateExecutionEngineForModule function from the C API. I am get a set fault with the following backtrace.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000120
0x0000000107c06643 in llvm::LLVMTargetMachine::addCommonCodeGenPasses ()
(gdb) bt
#0 0x0000000107c06643 in llvm::LLVMTargetMachine::addCommonCodeGenPasses ()
#1 0x0000000107c05c6b in llvm::LLVMTargetMachine::addPassesToEmitMachineCode ()
#2 0x0000000107ead7ab in llvm::JIT::JIT ()
#3 0x0000000107eaac21 in llvm::JIT::createJIT ()
#4 0x0000000107e2cbe4 in llvm::EngineBuilder::create ()
#5 0x0000000107e315b0 in LLVMCreateExecutionEngineForModule ()
#6 0x00000001002b1444 in ffi_call_unix64 () at darwin64.S:75
#7 0x00007fff5fbfc130 in ?? ()
(gdb)

I have called LLVMLinkInJIT before this.

Can anyone help?

-Eric

Hi Eric, if you build LLVM with assertions enabled (configure with
--enable-assertions) you may get a helpful error message.

Ciao, Duncan.