Ld_Library_Path: How to Find a Shared Object

LD_LIBRARY_PATH: Cannot open shared object file

LD_LIBRARY_PATH is a path. Therefore, try this, without the library file name:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'/home/nyu-debian/Desktop/Stage-Kaliterre/Project/Projects/AllJoyn/core/alljoyn/build/linux/x86_64/release/dist/cpp/lib'

LD_LIBRARY_PATH, the shared lib path in linux

Without the export your declared LD_LIBRARY_PATH is only valid in the script (.bashrc).
With the export it should work, but it is usually not a good idea to set your LD_LIBRARY_PATH like this.

If you don't want to install your library in the system path (e.g. /usr/lib) you should probably use a script that sets LD_LIBARAY_PATH locally and starts your application.

Linux: executable cannot find shared library

This is very simple: your library is not in the default system path from them the shared libraries are imported. During the compilation, the compile scripts solved these problems. In runtime, you have the LD_PRELOAD or LD_LIBRARY_PATH environment variables.

For example: an export LD_LIBRARY_PATH=/home/darkside/wunderprog/lib will extend the directoried searched for your libraries with the named directory. If there is your libcasablanca.so, you will get what you want.

Normally I use a /home/<myusername>/lib directory in my useronly accounts and set LD_LIBRARY_PATH from .profile.

CLion can't find shared library when running an executable

As oLen correctly pointed out, CLion doesn't seem to start as my user when launched via the GUI (Gnome in my case). I don't know as what it starts, but setting LD_LIBRARY_PATH=/usr/local/lib in /etc/profile and rebooting (or resourcing) it makes it work - in a nutshell the variable wasn't set for whatever user is running CLion.

Another way is Run -> Edit Configurations -> (select your application) -> Environment variables. Here you can manually set LD_LIBRARY_PATH to whatever you need, in my case to /usr/local/lib.



Related Topics



Leave a reply



Submit