X-Ryl669 / eMQTT5

An embedded MQTTv5 client in C++ with minimal footprint, maximal performance
MIT License
65 stars 14 forks source link

Cannot build with MQTTOnlyBSDSocket set to 0 [Windows build] #1

Closed juhda closed 4 years ago

juhda commented 4 years ago

Cannot build when setting the value of MQTTOnlyBSDSocket to 0 in lib/include/Network/Clients/MQTT.hpp because lib/src/Network/Clients/MQTTClient.cpp tries to include files that do not exist in the repository.

X-Ryl669 commented 4 years ago

Yes that's true. Those files are part of a very large networking multi-protocol library that we use internally for our needs and it's not open source (yet ?).

You have to define MQTTOnlyBSDSocket to 1. If you need TLS, you'll need to download and use MbedTLS library in that case. For an example code, you have the related repository or the fully featured MQTTc client in this repository.

X-Ryl669 commented 4 years ago

The code will build and work correctly with MQTTOnlyBSDSocket set to 1, I meant.

juhda commented 4 years ago

I understand. Thank you for the clarification.

We have a scenario when our application is compiled with Visual Studio, in which case BSD sockets are not available. That's why I started to look around in the code and tried to change the macro; I hoped it might help. Is there any straightforward solution to build with Visual Studio?

X-Ryl669 commented 4 years ago

Do you need SSL ?

Currently, I can easily add the missing Socket.hpp file but SSLSocket.hpp requires so much dependencies (mainly OpenSSL wrappers but also all crypto code that have nothing to do with this project).

I'm sorry I'm not using Windows anymore since many years. I know the Socket class is cross platform, but I don't know for SSLSocket status.

juhda commented 4 years ago

No need for SSL (currently).

X-Ryl669 commented 4 years ago

Ok, should be committed now. Please try again. You'll have to run ccmake (or cmake -DCROSSPLATFORM_SOCKET=ON) to enable cross platform socket code before rebuilding.

There is no cross platform SSL code currently, and I don't intend to re-write one.

The cross platform socket code is not exported upon library installation right now as I'm using the code in the tests subfolder, so you'll probably need to copy the missing files around if you intend to embed this code on windows.

juhda commented 4 years ago

Looks good. Thank you very much!