[Libwebsockets] error while loading shared libraries: libwebsockets.so.18: cannot open shared object file: No such file or directory

Andy Green andy at warmcat.com
Thu Jun 10 14:33:12 CEST 2021



On 6/10/21 1:24 PM, Lasse Järvensivu wrote:
> Hello all,
> 
> I recently started using C, Ubuntu LTS 20.04 and libwebsockets for a 
> project I am working on. I cloned main as described from the front page 
> and went to make and install as described in the build docs. Then I made 
> a small websocket server which is a mixmash of the minimal example of 
> echoing back to the user and the test server app. I removed most of the 
> test server app code so I could more easily understand it. Then I build 
> and run my server with the following commands:
> 
> $ gcc server.c -o server -lwebsockets
> $ ./server
> ./server: error while loading shared libraries: libwebsockets.so.18: 
> cannot open shared object file: No such file or directory
> 
> I have tried to figure out what may be causing this but I don't know for 
> sure. I built the source code with the -DLIB_SUFFIX=64 suffix to cmake, 
> if that may be of any help.

Whenever you build a new shared library and install it, you need to run 
ldconfig as root one time, so ld.so realizes that there is a new .so 
available when loading applications like ./server.

Packaging tools like apt or rpm take care of this chore for you, but 
when you build yourself, you need it do it.

-Andy



More information about the Libwebsockets mailing list