Cannot link against liblldb

I’m having problem creating my program using lldb API.

I can compile lldb successfully, and I can compile and link my program with:

clang++ -std=c++11 dbg.cpp -o dbg -I …/llvm/tools/lldb/include/ -L …/llvm-build/lib/ -llldb

But when I run the program it says

./dbg: error while loading shared libraries: cannot open shared object file: No such file or directory

I tried copy liblldb* to current directory and copy executable to llvm-build/lib directory, but no luck.

What os do you have?

dynamic linker doesn't search libraries in current directory by default,
it use LD_LIBRARY_PATH (linux) and DYLD_LIBRARY_PATH (osx) and also it
use DT_R{UN,}PATH but this is another story I guess.

So if you compile using -L ../llvm-build/lib, than you need do next:
$ export LD_LIBRARY_PATH=$PWD/../llvm-build/lib # for linux
$ ./dbg

Thanks, that solved my problem. (I’m using Ubuntu 14.04.1)