0

When I try to build and run the application I wrote from the Eclipse IDE, I am getting an error:

"error while loading shared libraries: liblog4cpp.so.5: cannot open shared object file: No such file or directory".

No compilation errors. But if I run the generated output file from the terminal, the application runs normally. When I use ldd for the application, all the libraries are lined.

From Eclipse, all the library paths are defined too.

project compiled build on Redhat7 OS and I use the log4cpp from below location https://sourceforge.net/projects/log4cpp/

What should be the issue

  • Looks that or a symbolic link is missing or the file is not on the path, did you verify that? – camp0 Feb 07 '20 at 09:41
  • Reinstall the package : Debian style → `$ sudo apt install --reinstall liblog4cpp5v5` .... Fedora style → `# dnf reinstall log4cpp` – Knud Larsen Feb 07 '20 at 09:49
  • It seems that you manage to build the executable but failing to run it from within Eclipse. This must indicate a setup error in the IDE configuration (maybe `LD_LIBRARY_PATH` is not set correctly). When succeeding running it from the command line, did you set any environment variables in particular? Do you have the *liblog4cpp.so.5* locally inside the directory? – Raz Rotenberg Feb 07 '20 at 09:56
  • @camp0 all the library files are at the path /usr/lib – Pubudu Ranathunga Feb 07 '20 at 10:32
  • @Raz Haleva LD_LIBRARY_PATH are configured and when I run with terminal I do not set any environment variables – Pubudu Ranathunga Feb 07 '20 at 10:36
  • @KnudLarsen when i install log4cpp and run get error"symbol lookup error: undefined symbol: _ZN7log4cpp8Appender29AppenderMapStorageInitializerC1Ev " – Pubudu Ranathunga Feb 07 '20 at 10:53
  • 1
    The error `symbol lookup error` indicates that the application was compiled on a different OS, or/and with different libraries. Please edit your question to include relevant OS specification, and the libraries you compiled against. – Knud Larsen Feb 07 '20 at 13:31
  • I have finally fixed the issue by manually copying the library files to /usr/local/lib64 – Pubudu Ranathunga Feb 10 '20 at 04:11

1 Answers1

0

Reinstalling iblog4cpp5v5 worked for me. You can do with:

sudo apt install --reinstall liblog4cpp5v5
elcortegano
  • 2,444
  • 11
  • 40
  • 58