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

How to build with WebSockets support #1397

Open
LiamFry opened this issue Sep 2, 2019 · 4 comments
Open

How to build with WebSockets support #1397

LiamFry opened this issue Sep 2, 2019 · 4 comments

Comments

@LiamFry
Copy link

LiamFry commented Sep 2, 2019

I'm attempting to build v. 1.6.4 with WebSockets support and it's not working.
I get no compile-time error. However, when I run the broker, the log file reports that websockets is not supported, "Error: Websockets support not available."

I've compiled using WITH_WEBSOCKETS=yes, and I have libwebsockets installed, but still no success. A look at config.mk suggests that there's no way to tell the build chain where to get libwebsockets from.

To include WebSocket support, the instructions say to make WITH_WEBSOCKETS=yes but that seems insufficient in and of itself. What am I doing wrong?

@LiamFry
Copy link
Author

LiamFry commented Sep 2, 2019

I rebuilt with cmake -D WITH_WEBSOCKETS=YES then make WITH_WEBSOCKET=YES (I don't know if I need both) and finally get an unresolved library reference error at link time. That's promising. But the question remains: how can I enable WebSockets support? OpenSSL and other options allow me to specify header and library paths, but no so with WebSockets.

@ralight
Copy link
Contributor

ralight commented Sep 3, 2019

Mosquitto has two ways of building. The first, and best supported, is the use of the plain makefiles provided. The second is to use cmake, for Windows and Mac, and for people who don't want to use the plain makefiles for whatever reason.

If you're using the plain makefiles, then make WITH_WEBSOCKETS=yes should be sufficient for most people. Specifying include/library paths can be done using make WITH_WEBSOCKETS=yes CFLAGS="-I<path to include>" LDFLAGS="-L<path to lib>".

If you're using then try cmake -DWITH_WEBSOCKETS=yes -DCMAKE_C_FLAGS="-I<path to include>" -DCMAKE_EXE_LINKER_FLAGS="-L<path to lib>"

I hope that helps.

@ralight
Copy link
Contributor

ralight commented Sep 24, 2019

Did this solve the problem?

@blusewang
Copy link

blusewang commented Oct 31, 2021

makefiles work, but cmake not work

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

3 participants