eclipse/paho.mqtt.c

Building Paho MQTT 1.3.13 client with OpenSSL 1.0.2 on Windows 11

muqtheear opened this issue · 3 comments

Hi,
I am trying to build the Paho MQTT 1.3.13 client with OpenSSL 1.0.2.
I am using Windows 11 and I tried the below command

cmake -G "Visual Studio 16 2019" -A Win32 -Bbuild -H. -DCMAKE_INSTALL_PREFIX=C:\Paho_Openssl-1.0.2_build_folder\paho.mqtt.c -DPAHO_BUILD_SAMPLES=TRUE -DPAHO_WITH_SSL=TRUE .\ -DOPENSSL_ROOT_DIR="C:\paho_mqtt_build_folder\openssl-lib-includes-1.0.2" -DOPENSSL_INCLUDE_DIR=C:\openssl-inc

I am getting the error saying that

"CMake Deprecation Warning at CMakeLists.txt:20 (CMAKE_MINIMUM_REQUIRED):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.

Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.

-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
-- CMake version: 3.27.0-rc4
-- CMake system name: Windows
-- Timestamp is 2023-11-20T06:22:01Z
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found
version "1.0.2�")
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.27/Modules/FindOpenSSL.cmake:668 (find_package_handle_standard_args)
src/CMakeLists.txt:194 (find_package)

-- Configuring incomplete, errors occurred!
"
Can you please suggest me how to proceed on this?

Thanks & Regards,
Muqtheear.S

The Windows CI builds are on AppVeyor. A build with OpenSSL 1.0.2 is here:

https://ci.appveyor.com/project/eclipsewebmaster/paho-mqtt-c/builds/48356239/job/reyd18smsd4fytba?fullLog=true

The AppVeyor configuration in the repo is in appveyor.yml.

Maybe those examples will help. Obviously you must have OpenSSL in the directory you point at, I'm assuming you do.

Thank you icraggs,
I don't have Appveyor access to build the Paho MQTT with the OpenSSL 1.0.2, looks like I have access only to help.appveyor.com.
Could you please suggest if any alternate way through Visual Studio Native Tools command prompt or normal command prompt.?

Thanks & Regards,
Muqtheear.S

The AppVeyor build is using the CMake command line. I hope it would show you what options are used to build in Windows to help you with your build.

There is also a cbuild.bat batch file in the repository which I use to build on my windows machine.

This does depend on a good installation of OpenSSL, For Windows, I use packages from https://slproweb.com/products/Win32OpenSSL.html. If you do install it from there, I would also advocate a small donation as suggested at the bottom of the page, as I've found these packages very useful.