Learn how to solve the Janus Gateway Build error ‘struct lws_context_creation_info’ has no member named ‘ws_ping_pong_interval’.

We wrote recently a detailed guide about how to install Janus Gateway on Ubuntu 18.04 on this article. The tutorial works great, however you will face some exceptions when you try to use the latest version of the libraries that Janus needs to work.

In this case, this issue was reported on our YouTube channel a couple of days after we published the tutorial. When you install the latest version of libwebsockets and Janus 0.10.0, if you try to run make on the janus gateway source code, the following exception will be triggered:

transports/janus_websockets.c: In function ‘janus_websockets_init’:
transports/janus_websockets.c:535:11: error: ‘struct lws_context_creation_info’ has no member named ‘ws_ping_pong_interval’
    wscinfo.ws_ping_pong_interval = pingpong_trigger;
           ^
Makefile:2204: recipe for target 'transports/transports_libjanus_websockets_la-janus_websockets.lo' failed
make[2]: *** [transports/transports_libjanus_websockets_la-janus_websockets.lo] Error 1
make[2]: Leaving directory '/root/janus-installers/janus-gateway'
Makefile:3189: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/janus-installers/janus-gateway'
Makefile:1431: recipe for target 'all' failed
make: *** [all] Error 2

It seems to happen only when libwebsockets has been built from the current master, so forcing a stable version like

# 1. Clone libwebsockets repo
git clone https://github.com/warmcat/libwebsockets.git
# 2. Change to its directory
cd libwebsockets
# 3. Use the stable v2.4
git checkout v2.4-stable

# 4. Follow the steps to build it 
mkdir build
cd build
cmake -DLWS_MAX_SMP=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..
make && sudo make install

After building libwebsockets with the specified version, you should be able now to run make on the janus directory.

Happy coding ❤️!


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors