[LLVMdev] lli --force-interpreter does not find external function

Duncan Sands baldrick at free.fr
Wed Mar 3 02:11:20 PST 2010


Hi Sebastian,

> I'm trying to run a LLVM-Bytecode-file in the interpreter (lli --force-interpreter), but i'm getting the following error-message:
>
> LLVM ERROR: Tried to execute an unknown external function: i8* (i32)* malloc
>
> My program is calling malloc. If I omit --force-interpreter everything runs as expected. Compiling to Assembler also works without problems. I have compiled LLVM with --enable-libffi. What am I doing wrong here?

I think you can specify additional libraries to search using:

   lli -load lib.so --force-interpreter bitcode.bc

However, for malloc you shouldn't need to.  I just tried lli built without
--enable-libffi, and got:

$ lli --force-interpreter in.bc
LLVM ERROR: Tried to execute an unknown external function: i8* (i32)* malloc

Rebuilding with --enable-libffi, I got:

$ lli --force-interpreter in.bc
8

I suspect that in spite of specifying --enable-libffi, you didn't build with
libffi support, perhaps because of missing headers.  Inspect config.log.
Another possibility is that you are using another copy of lli that happens
to be in your path, but that doesn't have libffi enabled.

Ciao,

Duncan.



More information about the llvm-dev mailing list