[lldb-dev] Cannot link against liblldb

Azat Khuzhin a3at.mail at gmail.com
Sun Mar 22 08:55:42 PDT 2015

On Sun, Mar 22, 2015 at 03:10:25PM +0000, Ziming Song wrote:
> 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: liblldb.so.3.7: 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

More information about the lldb-dev mailing list