redboltz / async_mqtt

Asynchronous MQTT communication library based on Boost.Asio
Boost Software License 1.0
91 stars 10 forks source link

Compile error when ASYNC_MQTT_USE_TLS=ON and/or ASYNC_MQTT_USE_WS=ON #321

Closed Meisterian closed 3 months ago

Meisterian commented 3 months ago

When I jumped from 5.1.2 to 8.0.0 it is not possible to compile the endpoint anymore for any client except for the mqtt client. I get a ton of errors using both clang (15 and 17) and gcc (12.2 and 13.2). The same errors occur when I try to compile client_cli. cmake -Bbuild -H. \ -DCMAKE_INSTALL_PREFIX=/usr \ -DASYNC_MQTT_USE_TLS=ON \ -DASYNC_MQTT_USE_WS=ON \ -DASYNC_MQTT_USE_LOG=OFF \ -DASYNC_MQTT_BUILD_UNIT_TESTS=OFF \ -DASYNC_MQTT_BUILD_SYSTEM_TESTS=OFF \ -DASYNC_MQTT_BUILD_TOOLS=ON \ -DASYNC_MQTT_BUILD_EXAMPLES=OFF \ -DASYNC_MQTT_PRINT_PAYLOAD=OFF \ -DASYNC_MQTT_USE_STR_CHECK=OFF \ -DCMAKE_CXX_COMPILER=clang++-17 cd build make -j22 client_cli I have attached the output from both clang and gcc in this issue. I have tried to compile the code in both Almalinux and Ubuntu. Do you know what can be wrong? Regards, Christian

clang.txt gcc.txt

redboltz commented 3 months ago

It works for me on my environment.

I need more information to investigate the issue. Could you post the cmake log on the clean environment ?

In the cloned async_mqtt directory:

rm -rf build
mkdir build
cd build
cmake -DCMAKE_CXX_COMPILER=clang++ -DASYNC_MQTT_USE_TLS=ON -DASYNC_MQTT_USE_WS=ON -DASYNC_MQTT_USE_LOG=OFF  -DASYNC_MQTT_BUILD_TOOLS=ON ..
Meisterian commented 3 months ago

Here is the cmake output: cmake -DCMAKE_CXX_COMPILER=clang++-17 -DASYNC_MQTT_USE_TLS=ON -DASYNC_MQTT_USE_WS=ON -DASYNC_MQTT_USE_LOG=OFF -DASYNC_MQTT_BUILD_TOOLS=ON .. -- The C compiler identification is GNU 13.2.0 -- The CXX compiler identification is Clang 17.0.2 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/clang++-17 - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Setting minimum C++ standard to C++17 -- Dynamically linking with Boost -- Dynamically linking with Openssl -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- TLS enabled -- WS enabled -- Logging disabled -- Print payload disabled -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.81.0") -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.10") -- Examples disabled -- Tools enabled -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.81.0") found components: program_options -- Found Doxygen: /usr/bin/doxygen (found version "1.9.4") found components: doxygen dot -- Configuring done (8.0s) -- Generating done (0.1s) -- Build files have been written to: /tmp/async_mqtt/build

CMakeCache.txt

Meisterian commented 3 months ago

I am using Windows Subsystem for Linux (WSL2). lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 23.10 Release: 23.10 Codename: mantic

I have never experienced any software I can't compile due to WSL2 before. I installed an arm toolchain as well, but get the same errors trying to compile client_cli. It is possible to create the tls, ws and wss endpoints, but using for example async_send and async_recv causes compilation errors. This seems to work fine for all endpoints: am::async_underlyinghandshake( ep.nextlayer(), host, boost::lexical_cast(port), *this ); I tested to checkout 5.1.2 and I am able to build client_cli. From 6.0.0, I get compilation errors.

redboltz commented 3 months ago

I have identified the issue. The minimum Boost version requirement was incorrect. I have updated the CMakeLists.txt and documentation in #322.

To build the tools, you need Boost 1.82.0 or later. To build the tests, you need Boost 1.84.0 or later.

I apologize for the incorrect documentation. Please try using the newer version of Boost.

Meisterian commented 3 months ago

Thank you for the quick reply, I can confirm that it compiled with Boost 1.83.0.

redboltz commented 3 months ago

Thank you for comfirming. I will release it as 8.0.1 ASAP.