halfgaar / FlashMQ

FlashMQ is a fast light-weight MQTT broker/server, designed to take good advantage of multi-CPU environments
https://www.flashmq.org/
Open Software License 3.0
173 stars 24 forks source link

Build with musl #38

Closed sikmir closed 1 year ago

sikmir commented 1 year ago

I tried to compile with musl, but got errors:

flashmq> [ 18%] Building CXX object CMakeFiles/flashmq.dir/types.cpp.o
flashmq> In file included from /build/source/utils.h:34,
flashmq>                  from /build/source/utils.cpp:20:
flashmq> /build/source/cirbuf.h:55:21: error: ‘uint’ has not been declared
flashmq>    55 |     void doubleSize(uint factor = 2);
flashmq>       |                     ^~~~
flashmq> In file included from /build/source/utils.h:34,
flashmq>                  from /build/source/mainapp.h:35,
flashmq>                  from /build/source/mainapp.cpp:18:
flashmq> /build/source/cirbuf.h:55:21: error: ‘uint’ has not been declared
flashmq>    55 |     void doubleSize(uint factor = 2);
flashmq>       |                     ^~~~
flashmq> In file included from /build/source/session.cpp:20:
flashmq> /build/source/session.h:95:38: error: ‘u_int16_t’ has not been declared
flashmq>    95 |     bool removeIncomingQoS2MessageId(u_int16_t packet_id);
flashmq>       |                                      ^~~~~~~~~
flashmq> /build/source/session.h:98:38: error: ‘u_int16_t’ has not been declared
flashmq>    98 |     void removeOutgoingQoS2MessageId(u_int16_t packet_id);
flashmq>       |                                      ^~~~~~~~~
flashmq> In file included from /build/source/variablebyteint.h:4,
flashmq>                  from /build/source/mqtt5properties.h:7,
flashmq>                  from /build/source/types.cpp:21:
flashmq> /build/source/cirbuf.h:55:21: error: ‘uint’ has not been declared
flashmq>    55 |     void doubleSize(uint factor = 2);
flashmq>       |                     ^~~~
flashmq> /build/source/session.cpp:330:6: error: no declaration matches ‘bool Session::removeIncomingQoS2MessageId(u_int16_t)’
flashmq>   330 | bool Session::removeIncomingQoS2MessageId(u_int16_t packet_id)
flashmq>       |      ^~~~~~~
flashmq> /build/source/session.h:95:10: note: candidate is: ‘bool Session::removeIncomingQoS2MessageId(int)’
flashmq>    95 |     bool removeIncomingQoS2MessageId(u_int16_t packet_id);
flashmq>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
flashmq> /build/source/session.h:33:7: note: ‘class Session’ defined here
flashmq>    33 | class Session
flashmq>       |       ^~~~~~~
flashmq> /build/source/session.cpp:358:6: error: no declaration matches ‘void Session::removeOutgoingQoS2MessageId(u_int16_t)’
flashmq>   358 | void Session::removeOutgoingQoS2MessageId(u_int16_t packet_id)
flashmq>       |      ^~~~~~~
flashmq> /build/source/session.h:98:10: note: candidate is: ‘void Session::removeOutgoingQoS2MessageId(int)’
flashmq>    98 |     void removeOutgoingQoS2MessageId(u_int16_t packet_id);
flashmq>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
flashmq> /build/source/session.h:33:7: note: ‘class Session’ defined here
flashmq>    33 | class Session
flashmq>       |       ^~~~~~~
halfgaar commented 1 year ago

I don't target musl. I've never even used it, actually.

Those types come from stdint.h. If you put #include <stdint.h> (almost) at the top of utils.h, does it work then? There may be more places it's necessary.

halfgaar commented 1 year ago

Did you try to continue with that? I don't primarily target musl, but if it's a matter of adding some includes, I can at least do that.

halfgaar commented 1 year ago

I recently got some more feedback from people building with musl, and it's not something I want to support now. FlashMQ targets GNU/Linux, so glibc is fine.