error when trying to create a JIT execution engine "Interpreter has not been linked in"

I've been following this guide: http://llvm.org/docs/tutorial/LangImpl4.html
and am getting an error when trying to create an execution engine. When
running this code:

executionEngine = llvm::EngineBuilder(module).setErrorStr(&errStr).create();

errStr contains: "Interpreter has not been linked in." I'm using this
command to build:

g++ -g errors.o lexer.o parser.o lang.o main.o -rdynamic `llvm-config
--cppflags --ldflags --libs core jit native` -O3 -o llvm-lisp
(my whole Makefile: http://pastebin.com/v33V48bH)

I'm on 64bit linux (ubuntu 10.04). What's causing the problem?

alecbenzer <alecbenzer@gmail.com> writes:

I've been following this guide: http://llvm.org/docs/tutorial/LangImpl4.html
and am getting an error when trying to create an execution engine. When
running this code:

executionEngine = llvm::EngineBuilder(module).setErrorStr(&errStr).create();

errStr contains: "Interpreter has not been linked in." I'm using this
command to build:

g++ -g errors.o lexer.o parser.o lang.o main.o -rdynamic `llvm-config
--cppflags --ldflags --libs core jit native` -O3 -o llvm-lisp
(my whole Makefile: http://pastebin.com/v33V48bH)

I'm on 64bit linux (ubuntu 10.04). What's causing the problem?

Probably you are not calling InitializeNativeTarget. Add this to your
source code:

....
#include "llvm/Target/TargetSelect.h"
...

int main() {
InitializeNativeTarget();
...