libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

lws_create_context: failed to load evlib_glib

Open acrilique opened this issue 1 year ago • 5 comments

This issue arose when I tried to compile a project that I wrote that uses libwebsockets using a machine running Fedora 41. The project was developed using Ubuntu 24.04 LTS and I never had a problem running it there. That's why I thought it had to be a problem with the Fedora package, so I opened an issue on their bugzilla:

Description Lluc 2024-11-10 22:33:11 UTC

Description of problem: Libwebsockets is not working if glib event loop option is specified.

Version-Release number of selected component (if applicable): 4.3.2-8

How reproducible: Always

Steps to Reproduce:

  1. Install libwebsockets and libwebsockets-devel using dnf
  2. Write a program that initializes libwebsockets requiring the use of glib's event loop:
    struct lws_context_creation_info info;
    memset(&info, 0, sizeof info);
    info.options = LWS_SERVER_OPTION_GLIB;
    ws_data.context = lws_create_context(&info);

  1. Compile and run the program

Actual results: I see this program output:

[2024/11/10 21:35:02:1240] E: lws_create_context: failed to load evlib_glib

And then websocket context initialization fails.

Expected results: Websocket context initialization should work.

Additional info: I have checked that all libwebsockets libs are in the correct folder, including libwebsockets-evlib_glib.so:

$ ls /usr/local/lib | grep libwebsockets
libwebsockets.a
libwebsockets-evlib_event.so
libwebsockets-evlib_ev.so
libwebsockets-evlib_glib.so
libwebsockets-evlib_uv.so
libwebsockets.so
libwebsockets.so.19

Comment 1 Fabian Affolter 2024-11-13 08:29:33 UTC

At first glances this looks like an upstream issue and not a packaging bug.

Please check https://libwebsockets.org/mailman/listinfo/libwebsockets (sorry, I can't find libwebsockets's issue tracker)

I hope that you'll be able to spot where the issue is and present a fix. If you think it's a packaging bug, I'll insist on that in the bugzilla. Thanks for your time.

acrilique avatar Nov 13 '24 08:11 acrilique

You can run it under strace and see what it's trying to do before it fails to load the dynlib.

I think if the dynlib needs a library that's not installed, it can also cause this kind of thing. But it should show up on strace output if so.

lws-team avatar Nov 13 '24 08:11 lws-team

I ran strace and couldn't see anything that seemed obvious to me. Here's a snippet of strace that I copied. Before that, there's a newfstatat(AT_FDCWD, "/usr/lib64/gstreamer-1.0/gst... line that is clearly not related to libwebsockets, so I assume that if the problem can be spotted on strace, it's in the snippet.

acrilique avatar Nov 13 '24 09:11 acrilique

I can't see why from the log either, is strace -f producing anything more interesting?

lws-team avatar Nov 14 '24 06:11 lws-team

Well, it seems to be loading font-related stuff and libasahi... then fails to load evlib_glib Log Still nothing I think

acrilique avatar Nov 14 '24 12:11 acrilique

It should be trying to load evlib_glib*.so at the start. Is it possible to make glib itself do verbose logging while it tries to start, eg, by env var or so on.

lws-team avatar Nov 14 '24 17:11 lws-team