Koozali.org formerly Contribs.org

Contribs.org Forums => SME 9.x Contribs => Topic started by: mhl on February 14, 2019, 09:26:29 AM

Title: Mosquitto MQTT Broker no libwebsockets
Post by: mhl on February 14, 2019, 09:26:29 AM
I'm trying to install Mosquitto MQTT Broker, but it can not find the required libwebsockets.
(https://wiki.contribs.org/Mosquitto_MQTT_Broker)

How do I get libwebsockets installed?
Title: Re: Mosquitto MQTT Broker no libwebsockets
Post by: ReetP on February 14, 2019, 10:58:18 AM
First thing is to have a search.

yum --enablerepo=* list available | grep "package"
yum --enablerepo=* list available “package”

That should show if it is available from an existing repo.

Be careful installing from any test repos. You can easily break your installation.

Let us know what you find.

Note if you are intending to reverse proxy websockets the installed version of Apache doesn't support them by default. There is a package available that will get it working.

Title: Re: Mosquitto MQTT Broker no libwebsockets
Post by: mhl on February 14, 2019, 12:57:02 PM
yum --enablerepo=* list available | grep "websocket"
or
yum --enablerepo=* list available | grep "socket"
gives no results.

I don't know how to preceed from here.
Title: Re: Mosquitto MQTT Broker no libwebsockets
Post by: ReetP on February 14, 2019, 04:09:42 PM
OK.

Seems that the only way to get libwebsockets now is to compile your own version.

The only available RPMs I can see require a higher version of GLIBC so they won't install.

So, just cos I was bored...

You need a build server setup. See the wiki.

You need cmake v2.8x - I think I have compiled this previously.

You may need these libraries to help build:
Code: [Select]
yum install libuv-devel libev-devel
Code: [Select]
git clone https://github.com/warmcat/libwebsockets
mkdir build
cd build
cmake ..
make package

Voila !

make package
[ 48%] Built target websockets
[ 48%] Built target test-client
[ 49%] Built target test-lejp
[ 50%] Built target test-server
[ 51%] Built target test-server-extpoll
[100%] Built target websockets_shared
Run CPack packaging tool...
CPack: Create package using RPM
CPack: Install projects
CPack: - Run preinstall target for: libwebsockets
CPack: - Install project: libwebsockets
CPack: Create package
CPackRPM: Will use GENERATED spec file: /home/john/git/libwebsockets/build/_CPack_Packages/Linux/RPM/SPECS/libwebsockets.spec
CPack: - package: /home/john/git/libwebsockets/build/libwebsockets-3.1.99-Linux.rpm generated.

I have absolutely NO idea if this will work.

The libev detection seems a bit wobbly so you can't use OS autodetect. The default config sets LIBEV to OFF. I tried setting it ON but the build failed so set it OFF again. You can test.

I tried various libev options to no effect. I know the files are on the server but I can't get them recognised:

Code: [Select]
cmake -DLWS_WITH_LIBEV=ON -DLWS_WITH_HTTP2=ON -DLWS_LIBEV_LIBRARIES:PATH=/usr/lib64 -DLIBEV_INCLUDE_DIRS:PATH=/usr/lib ..
But I get this error:

In file included from /home/john/git/libwebsockets/lib/core/private.h:135,
                 from /home/john/git/libwebsockets/lib/core/alloc.c:1:
/home/john/git/libwebsockets/include/libwebsockets.h:155:16: error: ev.h: No such file or directory

The files are there:

repoquery --list libev-devel
/usr/include/libev
/usr/include/libev/ev++.h
/usr/include/libev/ev.h
/usr/include/libev/event.h
/usr/lib/libev.so
/usr/lib/pkgconfig/libev.pc
/usr/include/ev++.h
/usr/include/ev.h
/usr/include/event.h
/usr/lib64/libev.so
/usr/share/man/man3/ev.3.gz


So no idea on that.

Test RPM can be downloaded from here. Please DO NOT test on ANYTHING apart from a test machine. It may break or introduce security issues into your server. Use at your own risk. You have been warned.

https://www.reetspetit.com/smetest/6/repoview/index.html
https://www.reetspetit.com/smetest/6/repoview/libwebsockets.html


Let us know how you get along.