[LLVMdev] Convert C code with external library access to llvm

Dan Liew dan at su-root.co.uk
Wed Sep 3 02:42:00 PDT 2014


On 3 September 2014 10:21, Prakash Premkumar <prakash.prax at gmail.com> wrote:
> Thanks for your reply dan.
> My question is how do I generate LLVM IR such that running the IR with
>>
>> $ lli output.s
>
> will produce the output intended by the program.
>
> Currently if do a lli output.s , I get an error :
>
>> LLVM ERROR: Program used external function 'sqlite3_open' which could not
>> be resolved!
>
>
>  so how should i link the -l sqlite3 flag during IR generation so that I can
> avoid this error ?

If you're under Linux you can do this

$ LD_PRELOAD=/usr/lib/libsqlite3.so lli output.s

This will preload the sqlite library so that the interpreter can find
the external functions.

On a completely different note please remember to do "reply-all" when
replying to emails so that llvmdev gets CC'ed so that everyone can
benefit from this discussion.

Hope that helps.



More information about the llvm-dev mailing list