Question

I made Netbeans work environment with SASL. The sample codes get build and it also run properly from Netbeans. But when I try to run my exe from Terminal it is not working. The error says as below:

./cppapplication_1: error while loading shared libraries: libanonymous.so.2: cannot open shared object file: No such file or directory

I tried setting the PATH using the below Command :

export PATH=/usr/lib64/sasl2/:$PATH

Still I am getting the same error. Do I need anything extra to do?

Was it helpful?

Solution

You need to add the path to libanonymous to the enviroment variable LD_LOAD_LIBRARY.

Update:

To do so:

  1. Locate the library, for example doing: find / -name "libanonymous.so.2" or by locate libanonymous.so.2
  2. Add the path found like so: export LD_LOAD_LIBRARY=$LD_LOAD_LIBRARY:<path to lib>

Update 1:

From your comment to Anon's answer I see that the lib in question is located under /usr/lib64/sasl2/.

So you might like to set LD_LOAD_LIBRAY path like so:

export LD_LOAD_LIBRARY=$LD_LOAD_LIBRARY:/usr/lib64/sasl2/

Update 2

This needs to be done in the same shell that later then executes the program needing the libraries (cppapplication_1).

cd <dir for cppapplication_1>; export LD_LOAD_LIBRARY=$LD_LOAD_LIBRARY:/usr/lib64/sasl2/; ./cppapplication_1

OTHER TIPS

You can also try this.

ldd <name of executable>

You will see dependent libs and their expected paths. See if the lib is present at the path executable is expecting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top