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
Execute Command as a String in Bash
How to Find Performance of Individual Functions in a Process Using Perf Tool
How to Remove Everything Else in a Folder Except Filea
How to Get a Faster Output Pipe Than /Dev/Null
How to Tell Linux to Keep a Page and Not Evict It
How to Set Errno in Linux Device Driver
Compile Errors Using Bfd.H on Linux
Unzip in Current Directory While Preserving File Structure
Move Cursor on Middle Button Paste in Sublime Text 3
Finding The Longest Word in a Text File
When Did Hup Stop Getting Sent and What How to Do About It
How to Store Result of Diff in Linux
How to Mmap() a Large File Without Risking The Oom Killer
Mmap /Dev/Fb0 Fails with "Invalid Argument"
Count The Occurrence of a String in an Input File
Adding a Shell Command Inside/Inline of a Systemd Service File