llvm-c: LLVMCreateExecutionEngine returning empty error message

Hello, I’m using the llvm-c bindings for C, but I’m getting some problems, the LLVMCreateExecutionEngine is returning 1 but the error message is an empty string (it’s !=NULL).

The steps I’m doing is to create the module, then I call LLVMVerifyModule to verify and it works fine, later I call LLVMCreateModuleProviderForExistingModule and it returns !=NULL MP, so it’s ok, but then when I call something like this: error_ret = LLVMCreateJITCompiler(&engine, provider, 0, &verror)
It returns 1 in error_ret and an empty string in verror, does someone knows why or how can I get the error message ? Or when it returns an empty error message ?
I’m using the pre built 2.6 binaries from default ubuntu karmic installation.

Thank you,

  • Christian

Just to report the answer to the problem if someone get the same problem with llvm-c bindings:

Before calling the LLVMCreateJITCompiler, you must do:
LLVMLinkInJIT();
LLVMLinkInInterpreter();
LLVMInitializeNativeTarget();

Otherwise it will return 1 and an empty error message.