0

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?

2vision2
  • 4,933
  • 16
  • 83
  • 164

2 Answers2

1

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.

Anon
  • 2,608
  • 6
  • 26
  • 38
  • I did I get the below response.linux-vdso.so.1 => (0x00007fff53bff000) libanonymous.so.2 => not found libcrammd5.so.2 => not found libdigestmd5.so.2 => not found libgssapiv2.so.2 => not found liblogin.so.2 => not found libplain.so.2 => not found libsasldb.so.2 => not found libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x00000039f6000000) But libanonymous.so.2 is present in the directory "/usr/lib64/sasl2/libanonymous.so.2" – 2vision2 Nov 19 '12 at 11:46
1

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
alk
  • 69,737
  • 10
  • 105
  • 255
  • I have Lots of .so files like this. So how to add? – 2vision2 Nov 19 '12 at 11:41
  • Thanks a lot for your updates. But still getting the same response. – 2vision2 Nov 19 '12 at 11:53
  • All the below are in /usr/lib64/sasl2/ libanonymous.so.2 => not found libcrammd5.so.2 => not found libdigestmd5.so.2 => not found libgssapiv2.so.2 => not found liblogin.so.2 => not found libplain.so.2 => not found libsasldb.so.2 => not found – 2vision2 Nov 19 '12 at 11:54
  • I am sorry I tried your update2 also. Still am getting the same error. – 2vision2 Nov 19 '12 at 12:01
  • You might like to check whether the entry `/usr/lib64/sasl2/libanonymous.so.2`isn't just a link to another file, which then in turn is missing. @2vision2 – alk Nov 19 '12 at 12:08