I want to use libwebsockets in a foreign libuv loop. My code (inspired from this simple example) compiles and links correctly, but at execution, on webpage request, the browser never receives a response from the server.
I build both libwebsockets (v3.1.0) and libuv (v1.25.0) from the sources in my cmake. I use the following command line:
cmake -DLWS_WITH_LIBUV=1 .. && make
And the cmake ouput mentions the correct value for the option:
LWS_WITH_LIBEV = OFF
LWS_WITH_LIBUV = 1
LWS_WITH_LIBEVENT = OFF
Grepping for the option in the build directory gives the following (which looks ok too):
CMakeCache.txt:483:LWS_WITH_LIBUV:BOOL=ON
extern/libwebsockets/include/libwebsockets/lws-service.h:185:#ifdef LWS_WITH_LIBUV
extern/libwebsockets/include/libwebsockets/lws-service.h:209:#endif /* LWS_WITH_LIBUV */
extern/libwebsockets/include/libwebsockets.h:157:#ifdef LWS_WITH_LIBUV
extern/libwebsockets/include/libwebsockets.h:165:#endif /* LWS_WITH_LIBUV */
extern/libwebsockets/include/lws_config.h:72:#define LWS_WITH_LIBUV
extern/libwebsockets/lws_config.h:72:#define LWS_WITH_LIBUV
However, with the following code (the closest I have from a minimal (not) working example) no message is displayed.
#include <uv.h>
int main()
{
#ifdef LWS_WITH_LIBUV
std::cout<<"With libuv"<<std::endl;
#endif
}
I've looked here and here and I do not know what to do next.
Turns out I had libwebsockets installed on my system and was linking against this system library, not compiled with libuv support.