Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Janus build broken #1009

Closed
fnoop opened this issue Sep 15, 2021 · 5 comments
Closed

Janus build broken #1009

fnoop opened this issue Sep 15, 2021 · 5 comments

Comments

@fnoop
Copy link
Member

fnoop commented Sep 15, 2021

  CC       transports/libjanus_websockets_la-janus_websockets.lo
transports/janus_websockets.c: In function ‘janus_websockets_reason_string’:
transports/janus_websockets.c:263:12: error: ‘LWS_CALLBACK_ADD_HEADERS’ undeclared (first use in this function); did you mean ‘LWS_CALLBACK_ADD_POLL_FD’?
   CASE_STR(LWS_CALLBACK_ADD_HEADERS);
            ^~~~~~~~~~~~~~~~~~~~~~~~
transports/janus_websockets.c:244:29: note: in definition of macro ‘CASE_STR’
 #define CASE_STR(name) case name: return #name
                             ^~~~
transports/janus_websockets.c:263:12: note: each undeclared identifier is reported only once for each function it appears in
   CASE_STR(LWS_CALLBACK_ADD_HEADERS);
            ^~~~~~~~~~~~~~~~~~~~~~~~
transports/janus_websockets.c:244:29: note: in definition of macro ‘CASE_STR’
 #define CASE_STR(name) case name: return #name
                             ^~~~
transports/janus_websockets.c: In function ‘janus_websockets_get_interface_name’:
transports/janus_websockets.c:305:30: warning: cast increases required alignment of target type [-Wcast-align]
     struct sockaddr_in *sa = (struct sockaddr_in *)(iap->ifa_addr);
                              ^
transports/janus_websockets.c:314:31: warning: cast increases required alignment of target type [-Wcast-align]
     struct sockaddr_in6 *sa = (struct sockaddr_in6 *)(iap->ifa_addr);
                               ^
transports/janus_websockets.c: In function ‘janus_websockets_common_callback’:
transports/janus_websockets.c:1441:8: error: ‘LWS_CALLBACK_ADD_HEADERS’ undeclared (first use in this function); did you mean ‘LWS_CALLBACK_ADD_POLL_FD’?
   case LWS_CALLBACK_ADD_HEADERS: {
        ^~~~~~~~~~~~~~~~~~~~~~~~
        LWS_CALLBACK_ADD_POLL_FD
transports/janus_websockets.c:1449:30: error: dereferencing pointer to incomplete type ‘struct lws_process_html_args’
       (unsigned char **)&args->p,
                              ^~
transports/janus_websockets.c:1460:37: warning: variable ‘methods’ set but not used [-Wunused-but-set-variable]
     char origin[256], headers[256], methods[256];
                                     ^~~~~~~
transports/janus_websockets.c:1629:17: error: implicit declaration of function ‘lws_write_ws_flags’; did you mean ‘BN_with_flags’? [-Werror=implicit-function-declaration]
     int flags = lws_write_ws_flags(LWS_WRITE_TEXT, ws_client->bufoffset == LWS_PRE, ws_client->bufpending <= (size_t)amount);
                 ^~~~~~~~~~~~~~~~~~
                 BN_with_flags
transports/janus_websockets.c:1629:17: warning: nested extern declaration of ‘lws_write_ws_flags’ [-Wnested-externs]
cc1: some warnings being treated as errors
make[2]: *** [Makefile:2360: transports/libjanus_websockets_la-janus_websockets.lo] Error 1
make[2]: Leaving directory '/srv/maverick/var/build/janus-gateway'
make[1]: *** [Makefile:3401: all-recursive] Error 1
make[1]: Leaving directory '/srv/maverick/var/build/janus-gateway'
make: *** [Makefile:1554: all] Error 2

Looks like Janus is trying to use websocket callback that doesn't exist in the version libwebsockets installed in Raspbian buster (2.0.3). lws api changes quite a bit and Janus requires fairly specific versions, so probably the easiest thing to do is compile lws separately into ~/software and use that.

@fnoop
Copy link
Member Author

fnoop commented Sep 17, 2021

Builds but can't find libwebsockets at runtime:

Sep 17 12:19:12 maverick-raspberry systemd[1]: Started WebRTC Janus Gateway.
Sep 17 12:19:12 maverick-raspberry janus[1154]: /srv/maverick/software/janus-gateway/bin/janus: error while loading shared libraries: libwebsockets.so.18: cannot open shared object file: No such file or directory
Sep 17 12:19:12 maverick-raspberry systemd[1]: maverick-webrtc.service: Main process exited, code=exited, status=127/n/a
Sep 17 12:19:12 maverick-raspberry systemd[1]: maverick-webrtc.service: Failed with result 'exit-code'.

@fnoop
Copy link
Member Author

fnoop commented Sep 17, 2021

Resolves on the command line:

[dev] [mav@maverick-raspberry /etc/systemd/system]$ ldd /srv/maverick/software/janus-gateway/bin/janus
	linux-vdso.so.1 (0xbeea5000)
	/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6f50000)
	libwebsockets.so.18 => /srv/maverick/software/libwebsockets/lib/libwebsockets.so.18 (0xb6ef5000)

This is probably because we set LD_LIBRARY_PATH in /etc/profile.d/41-maverick-libwebsockets-ldlibrarypath.sh but this isn't used in systemd. Either we should compile the rpath in, or set the runtime path in the systemd manifest.

@fnoop fnoop reopened this Sep 17, 2021
fnoop added a commit that referenced this issue Sep 17, 2021
@fnoop fnoop closed this as completed Sep 17, 2021
@fnoop fnoop reopened this Sep 18, 2021
@fnoop
Copy link
Member Author

fnoop commented Sep 18, 2021

Aargh, we need to add libnice build to ensure we get a supported version of libnice. This uses meson and stupidly installs to an architecture dependent libdir by default, so we can't find pkg-config.
mesonbuild/meson#1972
Answer is to set libdir in the meson step, then we can set PKG_CONFIG_PATH reliably across different platforms.

@fnoop
Copy link
Member Author

fnoop commented Sep 18, 2021

janus not finding new libnice libraries at startup:

Sep 18 12:30:46 maverick-raspberry systemd[1]: Started WebRTC Janus Gateway.
Sep 18 12:30:46 maverick-raspberry janus[27636]: /srv/maverick/software/janus-gateway/bin/janus: error while loading shared libraries: libnice.so.10: cannot open shared object file: No such file or directory
Sep 18 12:30:46 maverick-raspberry systemd[1]: maverick-webrtc.service: Main process exited, code=exited, status=127/n/a
Sep 18 12:30:46 maverick-raspberry systemd[1]: maverick-webrtc.service: Failed with result 'exit-code'.

It does resolve them on the command line:

[dev] [mav@maverick-raspberry ~/var/build]$ ldd /srv/maverick/software/janus-gateway/bin/janus
	linux-vdso.so.1 (0xbee4b000)
	/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6ee1000)
	libwebsockets.so.18 => /srv/maverick/software/libwebsockets/lib/libwebsockets.so.18 (0xb6e86000)
	libconfig.so.9 => /lib/arm-linux-gnueabihf/libconfig.so.9 (0xb6e44000)
	libnice.so.10 => /srv/maverick/software/libnice/lib/libnice.so.10 (0xb6df1000)

So rpath must not be baked into the binary correctly.

[dev] [mav@maverick-raspberry ~/var/build]$ readelf -d  /srv/maverick/software/janus-gateway/bin/janus |grep runpath
 0x0000001d (RUNPATH)                    Library runpath: [/srv/maverick/software/libwebsockets/lib]

Hmm, it is being set at compile time:
"LDFLAGS=-L/srv/maverick/software/libwebsockets/lib -lwebsockets -L/srv/maverick/software/libnice/lib -lnice -Wl,-rpath=/srv/maverick/software/libwebsockets/lib,-rpath=/srv/maverick/software/libnice/lib",

@fnoop
Copy link
Member Author

fnoop commented Sep 18, 2021

Fixed:
0x0000001d (RUNPATH) Library runpath: [/srv/maverick/software/libnice/lib:/srv/maverick/software/libwebsockets/lib]

@fnoop fnoop closed this as completed Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant