Mosquitto: Still Websockets support not available

Created on 31 Aug 2017  Â·  33Comments  Â·  Source: eclipse/mosquitto

I understand what this error is but still having real issues with this. I left it for around a year as it was just annoying me but I need to get this back up and running. Today I have reinstalled libwebsockets and with mosquitto 1.4.9, 1.4.10, 1.4.13 I have edited the config.mk file to use websockets. make, make install and attempted to restart mosquitto with the websockets running and still I get:

Starting Mosquitto MQTT brokerError: Websockets support not available.

Totally lost as to what is going on, if anyone can shed some light would be great. TIA

All 33 comments

And which versions of libwebsockets did you try?

Thanks for the reply. The latest from GIT but last time I was trying to solve I tried different ones. It happened when I patched the OpenSSL vulnerability last year I think it was, after that it stopped working,

https://github.com/warmcat/libwebsockets.git

The previous issue was #195. I would repeat the request that I made there: could you please make a video of you compiling mosquitto from scratch (with a fresh source tar/zip) so we can see what is going wrong. The example of me doing that is https://asciinema.org/a/d2v33b1722xukttxnlkyyhpu1 , if you could replicate that exactly in a video it would be helpful.

I can give you the exact steps I took:

git clone https://github.com/warmcat/libwebsockets.git

cd libwebsockets
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc
make
make install

Also tried below with the above versions I mentioned:

wget http://mosquitto.org/files/source/mosquitto-1.4.10.tar.gz
tar xvzf mosquitto-1.4.10.tar.gz
cd mosquitto-1.4.10/

sudo nano config.mk

Change WITH_WEBSOCKETS to yes

make
sudo make install

All goes successfully, I restart mosquitto with websockets enabled an get the error message about websockets

Sorry to labour the point, but something clearly isn't working for you and as the description you're giving looks correct there must be something extra we aren't seeing. If you make a video of you getting the source, compiling and testing then we'll see what the problem is. It doesn't need to be a high quality video, it doesn't need any talking. It could be on your phone as long as the screen is still readable. We do need to see what is happening though.

Some further points:

  • Please use make WITH_WEBSOCKETS=yes instead of editing config.mk to minimise the risk of editing errors
  • Please post the output of which mosquitto
  • Please post the output of ldd /usr/local/sbin/mosquitto
  • Finally, libwebsockets likes to change their interface a lot, so I'd only recommend using released versions. Version 2.1.x is a good choice.

which mosquitto
/usr/local/sbin/mosquitto

ldd /usr/local/sbin/mosquitto
linux-vdso.so.1 => (0x00007fffe9bd3000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003108000000)
libm.so.6 => /lib64/libm.so.6 (0x0000003108800000)
librt.so.1 => /lib64/librt.so.1 (0x0000003109000000)
libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f5889461000)
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f588907c000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f5888e77000)
libwebsockets.so.5 => /usr/lib/libwebsockets.so.5 (0x00007f5888c5e000)
libc.so.6 => /lib64/libc.so.6 (0x0000003107c00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003107800000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003108400000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x000000310d400000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x000000310ac00000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x000000310a400000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x000000310dc00000)
libz.so.1 => /lib64/libz.so.1 (0x0000003108c00000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x000000310d800000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x000000310c000000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003109c00000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003109400000)

OK I have rebuilt websockets using -DLIB_SUFFIX=64 and attempting to install 1.4.13 but I get those errors/warnings again:

loop.c: In function ‘loop_handle_reads_writes’:
loop.c:492: error: storage size of ‘wspoll’ isn’t known
loop.c:496: warning: implicit declaration of function ‘lws_service_fd’
loop.c:496: warning: implicit declaration of function ‘lws_get_context’
loop.c:492: warning: unused variable ‘wspoll’
make[1]: *** [loop.o] Error 1

I saw you had a patch for debian, would it be the same for Centos

I imagine that is just because it is self installed rather than distro provided. That output shows that mosquitto is linked against libwebsockets though. The only way for that to happen is if WITH_WEBSOCKETS is set correctly. If WITH_WEBSOCKETS is set, there should be no way for the Warning: Websockets support not available. message to be present.

Yes, the same patch should work fine for Centos.

Yes, but it is lol. Ok thanks will try again.

Could you post the output of grep "Websockets support not available" /usr/local/sbin/mosquitto please?

Yes one second, trying with your patch and 1.4.14 it has made it worse now:

[~/mosquitto-1.4.14]# sudo make WITH_WEBSOCKETS=yes
set -e; for d in lib client src; do make -C ${d}; done
make[1]: Entering directory `/home/dcrwslz/mosquitto-1.4.14/lib'
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c mosquitto.c -o mosquitto.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c logging_mosq.c -o logging_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c memory_mosq.c -o memory_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c messages_mosq.c -o messages_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c net_mosq.c -o net_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c read_handle.c -o read_handle.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c read_handle_client.c -o read_handle_client.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c read_handle_shared.c -o read_handle_shared.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c send_mosq.c -o send_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c send_client_mosq.c -o send_client_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c socks_mosq.c -o socks_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c srv_mosq.c -o srv_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c thread_mosq.c -o thread_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c time_mosq.c -o time_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c tls_mosq.c -o tls_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c util_mosq.c -o util_mosq.o
cc -Wall -ggdb -O2  -I. -I.. -I../lib -fPIC -DWITH_TLS -DWITH_TLS_PSK -DWITH_THREADING -DWITH_SOCKS -DWITH_SRV -c will_mosq.c -o will_mosq.o
cc -shared  -Wl,--version-script=linker.version -Wl,-soname,libmosquitto.so.1 mosquitto.o logging_mosq.o memory_mosq.o messages_mosq.o net_mosq.o read_handle.o read_handle_client.o read_handle_shared.o send_mosq.o send_client_mosq.o socks_mosq.o srv_mosq.o thread_mosq.o time_mosq.o tls_mosq.o util_mosq.o will_mosq.o -o libmosquitto.so.1  -lrt -lssl -lcrypto -lpthread -lcares
ar cr libmosquitto.a mosquitto.o logging_mosq.o memory_mosq.o messages_mosq.o net_mosq.o read_handle.o read_handle_client.o read_handle_shared.o send_mosq.o send_client_mosq.o socks_mosq.o srv_mosq.o thread_mosq.o time_mosq.o tls_mosq.o util_mosq.o will_mosq.o
make -C cpp
make[2]: Entering directory `/home/dcrwslz/mosquitto-1.4.14/lib/cpp'
g++ -Wall -ggdb -O2  -I. -I.. -I../lib  -fPIC -c mosquittopp.cpp -o mosquittopp.o
g++ -shared  -Wl,-soname,libmosquittopp.so.1 mosquittopp.o -o libmosquittopp.so.1 ../libmosquitto.so.1
make[2]: Leaving directory `/home/dcrwslz/mosquitto-1.4.14/lib/cpp'
make[1]: Leaving directory `/home/dcrwslz/mosquitto-1.4.14/lib'
make[1]: Entering directory `/home/dcrwslz/mosquitto-1.4.14/client'
cc -c pub_client.c -o pub_client.o -Wall -ggdb -O2  -I../lib -DVERSION="\"1.4.14\"" -DWITH_TLS -DWITH_TLS_PSK -DWITH_SOCKS -DWITH_SRV
cc -c client_shared.c -o client_shared.o -Wall -ggdb -O2  -I../lib -DVERSION="\"1.4.14\"" -DWITH_TLS -DWITH_TLS_PSK -DWITH_SOCKS -DWITH_SRV
cc pub_client.o client_shared.o -o mosquitto_pub  -L../lib ../lib/libmosquitto.so.1
cc -c sub_client.c -o sub_client.o -Wall -ggdb -O2  -I../lib -DVERSION="\"1.4.14\"" -DWITH_TLS -DWITH_TLS_PSK -DWITH_SOCKS -DWITH_SRV
cc sub_client.o client_shared.o -o mosquitto_sub  -L../lib ../lib/libmosquitto.so.1
make[1]: Leaving directory `/home/dcrwslz/mosquitto-1.4.14/client'
make[1]: Entering directory `/home/dcrwslz/mosquitto-1.4.14/src'
cc -Wall -ggdb -O2  -I. -I.. -I../lib  -DVERSION="\"1.4.14\"" -DTIMESTAMP="\"2017-08-31 15:54:10+0200\"" -DWITH_BROKER -DWITH_TLS -DWITH_TLS_PSK -DWITH_UUID -DWITH_BRIDGE -DWITH_PERSISTENCE -DWITH_MEMORY_TRACKING -DWITH_SYS_TREE -DWITH_WEBSOCKETS -DWITH_EC -c mosquitto.c -o mosquitto.o
In file included from mosquitto.c:50:
./mosquitto_broker.h:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
In file included from mosquitto.c:50:
./mosquitto_broker.h:1:18: error: too many decimal points in number
./mosquitto_broker.h:3:15: error: too many decimal points in number
./mosquitto_broker.h:4:15: error: too many decimal points in number
./mosquitto_broker.h:5: error: stray ‘@’ in program
./mosquitto_broker.h:5: error: stray ‘@’ in program
./mosquitto_broker.h:5: error: stray ‘@’ in program
./mosquitto_broker.h:5: error: stray ‘@’ in program
./mosquitto_broker.h:8:5: error: #endif without #if
./mosquitto_broker.h:10: error: stray ‘#’ in program
./mosquitto_broker.h:11:3: error: #endif without #if
In file included from /usr/local/include/openssl/crypto.h:120,
                 from /usr/local/include/openssl/comp.h:5,
                 from /usr/local/include/openssl/ssl.h:149,
                 from ../lib/mosquitto_internal.h:27,
                 from ./mosquitto_broker.h:13,
                 from mosquitto.c:50:
/usr/include/stdlib.h:863: error: expected ‘)’ before ‘*’ token
/usr/include/stdlib.h:867: error: expected declaration specifiers or ‘...’ before ‘wchar_t’
/usr/include/stdlib.h:871: error: expected ‘)’ before ‘*’ token
/usr/include/stdlib.h:875: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
In file included from mosquitto.c:50:
./mosquitto_broker.h:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
./mosquitto_broker.h:14:18: error: too many decimal points in number
./mosquitto_broker.h:16:15: error: too many decimal points in number
./mosquitto_broker.h:17:15: error: too many decimal points in number
./mosquitto_broker.h:18: error: stray ‘@’ in program
./mosquitto_broker.h:18: error: stray ‘@’ in program
./mosquitto_broker.h:18: error: stray ‘@’ in program
./mosquitto_broker.h:18: error: stray ‘@’ in program
./mosquitto_broker.h:20: error: ‘int_db’ undeclared here (not in a function)
./mosquitto_broker.h:22: error: expected identifier or ‘(’ before ‘-’ token
./mosquitto_broker.h:23: error: expected identifier or ‘(’ before ‘+’ token
./mosquitto_broker.h:27: error: stray ‘@’ in program
./mosquitto_broker.h:27: error: stray ‘@’ in program
./mosquitto_broker.h:27: error: expected identifier or ‘(’ before ‘-’ token
./mosquitto_broker.h:27: error: stray ‘@’ in program
./mosquitto_broker.h:27: error: stray ‘@’ in program
./mosquitto_broker.h:32: error: expected identifier or ‘(’ before ‘while’
./mosquitto_broker.h:33: error: expected identifier or ‘(’ before ‘-’ token
./mosquitto_broker.h:42:18: error: too many decimal points in number
./mosquitto_broker.h:44:15: error: too many decimal points in number
./mosquitto_broker.h:45:15: error: too many decimal points in number
./mosquitto_broker.h:46: error: stray ‘@’ in program
./mosquitto_broker.h:46: error: stray ‘@’ in program
./mosquitto_broker.h:46: error: stray ‘@’ in program
./mosquitto_broker.h:46: error: stray ‘@’ in program
./mosquitto_broker.h:54:3: error: #endif without #if
In file included from ../lib/util_mosq.h:25,
                 from mosquitto.c:52:
./mosquitto_broker.h:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
In file included from ../lib/util_mosq.h:25,
                 from mosquitto.c:52:
./mosquitto_broker.h:1:18: error: too many decimal points in number
./mosquitto_broker.h:3:15: error: too many decimal points in number
./mosquitto_broker.h:4:15: error: too many decimal points in number
./mosquitto_broker.h:5: error: stray ‘@’ in program
./mosquitto_broker.h:5: error: stray ‘@’ in program
./mosquitto_broker.h:5: error: stray ‘@’ in program
./mosquitto_broker.h:5: error: stray ‘@’ in program
./mosquitto_broker.h:8:5: error: #endif without #if
./mosquitto_broker.h:10: error: stray ‘#’ in program
./mosquitto_broker.h:11:3: error: #endif without #if
./mosquitto_broker.h:14:18: error: too many decimal points in number
./mosquitto_broker.h:16:15: error: too many decimal points in number
./mosquitto_broker.h:17:15: error: too many decimal points in number
./mosquitto_broker.h:18: error: stray ‘@’ in program
./mosquitto_broker.h:18: error: stray ‘@’ in program
./mosquitto_broker.h:18: error: stray ‘@’ in program
./mosquitto_broker.h:18: error: stray ‘@’ in program
./mosquitto_broker.h:20: error: redefinition of ‘db’
./mosquitto_broker.h:20: note: previous definition of ‘db’ was here
./mosquitto_broker.h:22: error: expected identifier or ‘(’ before ‘-’ token
./mosquitto_broker.h:23: error: expected identifier or ‘(’ before ‘+’ token
./mosquitto_broker.h:27: error: stray ‘@’ in program
./mosquitto_broker.h:27: error: stray ‘@’ in program
./mosquitto_broker.h:27: error: expected identifier or ‘(’ before ‘-’ token
./mosquitto_broker.h:27: error: stray ‘@’ in program
./mosquitto_broker.h:27: error: stray ‘@’ in program
./mosquitto_broker.h:32: error: expected identifier or ‘(’ before ‘while’
./mosquitto_broker.h:33: error: expected identifier or ‘(’ before ‘-’ token
./mosquitto_broker.h:42:18: error: too many decimal points in number
./mosquitto_broker.h:44:15: error: too many decimal points in number
./mosquitto_broker.h:45:15: error: too many decimal points in number
./mosquitto_broker.h:46: error: stray ‘@’ in program
./mosquitto_broker.h:46: error: stray ‘@’ in program
./mosquitto_broker.h:46: error: stray ‘@’ in program
./mosquitto_broker.h:46: error: stray ‘@’ in program
./mosquitto_broker.h:54:3: error: #endif without #if
mosquitto.c:85: warning: ‘struct mqtt3_config’ declared inside parameter list
mosquitto.c: In function ‘drop_privileges’:
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: warning: left-hand operand of comma expression has no effect
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: warning: left-hand operand of comma expression has no effect
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:93: error: dereferencing pointer to incomplete type
mosquitto.c:94: error: dereferencing pointer to incomplete type
mosquitto.c:96: warning: implicit declaration of function ‘_mosquitto_log_printf’
mosquitto.c:96: error: dereferencing pointer to incomplete type
mosquitto.c:99: error: dereferencing pointer to incomplete type
mosquitto.c: In function ‘main’:
mosquitto.c:219: error: storage size of ‘config’ isn’t known
mosquitto.c:258: error: invalid application of ‘sizeof’ to incomplete type ‘struct mosquitto_db’
mosquitto.c:260: warning: implicit declaration of function ‘_mosquitto_net_init’
mosquitto.c:262: warning: implicit declaration of function ‘mqtt3_config_init’
mosquitto.c:263: warning: implicit declaration of function ‘mqtt3_config_parse_args’
mosquitto.c:265: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:282: warning: implicit declaration of function ‘mqtt3_db_open’
mosquitto.c:290: warning: implicit declaration of function ‘mqtt3_log_init’
mosquitto.c:301: warning: implicit declaration of function ‘mosquitto_security_module_init’
mosquitto.c:303: warning: implicit declaration of function ‘mosquitto_security_init’
mosquitto.c:310: warning: implicit declaration of function ‘mqtt3_db_messages_easy_queue’
mosquitto.c:319: error: ‘mp_mqtt’ undeclared (first use in this function)
mosquitto.c:319: error: (Each undeclared identifier is reported only once
mosquitto.c:319: error: for each function it appears in.)
mosquitto.c:320: warning: implicit declaration of function ‘mqtt3_socket_listen’
mosquitto.c:321: warning: implicit declaration of function ‘mqtt3_db_close’
mosquitto.c:337: error: ‘INVALID_SOCKET’ undeclared (first use in this function)
mosquitto.c:350: error: ‘mp_websockets’ undeclared (first use in this function)
mosquitto.c:352: warning: implicit declaration of function ‘mosq_websockets_init’
mosquitto.c:377: warning: implicit declaration of function ‘mqtt3_bridge_new’
mosquitto.c:385: warning: implicit declaration of function ‘mosquitto_main_loop’
mosquitto.c:388: warning: implicit declaration of function ‘mqtt3_log_close’
mosquitto.c:391: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:392: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:393: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:395: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:396: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:401: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:401: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:401: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:401: warning: left-hand operand of comma expression has no effect
mosquitto.c:402: warning: implicit declaration of function ‘mqtt3_context_send_will’
mosquitto.c:407: warning: implicit declaration of function ‘mqtt3_db_backup’
mosquitto.c:411: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:411: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:411: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:411: warning: left-hand operand of comma expression has no effect
mosquitto.c:414: warning: implicit declaration of function ‘mqtt3_context_cleanup’
mosquitto.c:420: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:420: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:420: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:420: warning: left-hand operand of comma expression has no effect
mosquitto.c:424: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:425: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:426: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:429: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:430: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:433: warning: implicit declaration of function ‘mosquitto__free_disused_contexts’
mosquitto.c:450: warning: implicit declaration of function ‘mosquitto_security_module_cleanup’
mosquitto.c:456: warning: implicit declaration of function ‘mqtt3_config_cleanup’
mosquitto.c:456: error: invalid use of undefined type ‘struct mosquitto_db’
mosquitto.c:457: warning: implicit declaration of function ‘_mosquitto_net_cleanup’
mosquitto.c:219: warning: unused variable ‘config’
make[1]: *** [mosquitto.o] Error 1
make[1]: Leaving directory `/home/dcrwslz/mosquitto-1.4.14/src'
make: *** [mosquitto] Error 2

grep "Websockets support not available" /usr/local/sbin/mosquitto returns empty

 sudo service mosquitto restart
Shutting down Mosquitto MQTT broker                        [  OK  ]
Starting Mosquitto MQTT brokerError: Websockets support not available.
Error found at /etc/mosquitto/conf.d/mosquitto.conf:43.
Error found at /etc/mosquitto/mosquitto.conf:10.
Error: Unable to open configuration file.
                                                           [FAILED]

"Returns empty" means it is impossible for that executable to print that string. You must have another version of mosquitto somewhere else on the system. Does /usr/sbin/mosquitto exist?

On the patch output - it looks like there is a conflict and so the patch tool has left the reject information in mosquitto.h, which is breaking the build.

-bash: cd: /usr/sbin/mosquitto: Not a directory

 sudo service mosquitto start
Starting Mosquitto MQTT brokerError: Websockets support not available.
Error found at /etc/mosquitto/conf.d/mosquitto.conf:43.
Error found at /etc/mosquitto/mosquitto.conf:10.
Error: Unable to open configuration file.
                                                           [FAILED]

The ldd of mosquitto says it's looking for libwebsockets.so.5. This is libwebsockets 1.5, which basically just doesn't work.

I presume it's linking against a version of lws from your distro, and when you do "make/make install" of your git clone of LWS, that's just installing into /usr/local/lib or similar, and is simply not being looked at.

What to do now lol ?

do you have libwebsockets installed from your distro? remove it.
you'll then get link failures until you tell mosquitto's build where yoiur libwebsocket install is.

https://libwebsockets.org/abi/timeline/libwebsockets/index.html shows the so names that libwebsockets has used. You definitely don't want to have it looking for libwebsockets.so.5

All of them have been installed from source. How do I tell it to point to the right one and which is the right one ?

-bash: cd: /usr/sbin/mosquitto: Not a directory - well no, we wouldn't expect it to be a directory :)

I bet if you run sudo rm /usr/sbin/mosquitto, then try to restart the service it will fail because mosquito no longer exists. I think your init script points to /usr/sbin/mosquitto, and that version doesn't have websockets support.

It doesnt say unknown service it just returns nothing, but definitely is not even attempting to now? Should I try unzip and install again ?

I hope this works as our PaaS is now offline lol

Edit your init script to point to /usr/local/sbin/mosquitto to use your compiled version.

Sorry which init script?

Whichever script your system uses to start the mosquitto service. Probably either /etc/init.d/mosquitto or /etc/systemd/system/mosquitto.service

Devices are working going to get my websocket demo set back up and test, thanks again mate. Will come back and let you know.

It is working mate, thank you for getting that sorted, legend!

Glad we got it sorted finally :)

@AdamMiltonBarker
What steps you followed further to solve this issue. Will you please help me in getting the issue sorted.
I have mentioned the problems i am facing in this
https://github.com/eclipse/mosquitto/issues/699

The solution was found via the the help in this thread, there was a conflicting version of mosquitto installed, once removed everything worked, I will have a look at your issue now to see if I can offer you some help.

I solve the problem by adding -DWITH_WEBSOCKETS=ON with cmake

Was this page helpful?
0 / 5 - 0 ratings