polybar: Cannot open shared object file libjsoncpp.so
I’m getting this error code while trying to start polybar
[daniel@laptop ~]$ polybar main
polybar: error while loading shared libraries: libjsoncpp.so.11: cannot open shared object file: No such file or directory
However jsoncpp should be installed.
[daniel@laptop ~]$ yaourt jsoncpp
1 extra/jsoncpp 1.8.3-1 [installed]
C++ library for interacting with JSO
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 25 (6 by maintainers)
@ginglis13 Yeah, because, just as it was mentioned multiple times before, recompiling fixes the issue.
Same thing again - libjsoncpp was updated. Recompiling fixes the issue.
This problem just popped up again.
@PonasKovas I think this is why:
https://github.com/polybar/polybar/wiki/Known-Issues#error-while-loading-shared-libraries-libjsoncpp
You have to recompile polybar, see #871
I just had the same problem. Reinstalling polybar worked for me. Thanks.
When jsoncpp introduces possibly breaking changes to its library, it will bump the so called
SONAMEfield in the library. If you compiled polybar withjsoncpp 1.8.4, polybar was linked againstlibjsoncpp.so.20. So everytime thepolybarexectuable is run, the operating system will search for thelibjsoncpp.so.20file for dynamic linking. Now if you update jsoncpp to version 1.9.1, which comes withlibjsoncpp.so.21, the OS can no longer findlibjsoncpp.so.20when running polybar and will crash with the mentioned error message.This is neither a bug in polybar nor in jsoncpp @Jezorko. This is one of the downsides of polybar not being pre-packaged on many platforms because you can update jsoncpp without needing to re-link polybar.
The fix for it didn’t change. You have to recompile polybar.
On Fri, Feb 2, 2018, 03:36 Dessalines notifications@github.com wrote:
Already got the same problem few months ago and completely reinstalling from the AUR worked well but this time it doesn’t fix the problem, I’ve tried with polybar and polybar-git
polybar: error while loading shared libraries: libjsoncpp.so.22: cannot open shared object file: No such file or directory@Cory-Watson
This is guided by linker internals. If you link to a shared library, the linker will actually link to the
SONAMEwhich islibjsoncpp.so.XX, nothing we can do about that I think.Also linking directly to
libjsoncpp.soisn’t a good idea because the whole point ofSONAMEis to prevent running an executable with a library that is incompatible (has a differentSONAME). For that reason creating the symlink is also not a good idea. In the case of jsoncpp it’s probably fine, but imaginelibjsoncpp.so.21is completely different fromlibjsoncpp.so.20, now you run polybar which is linked tolibjsoncpp.so.20with the symlink that points tolibjsoncpp.so.21. In the best case, polybar won’t even start because of a linker error, in the worst case the calls that polybar makes to jsoncpp have malformed inputs and produce unexpected outputs or undefined behavior.