ove
ove

Reputation: 1

Windows solution for openssl/ssl.h no such file?

I'm trying to do this in Windows using Git CMD

C:\Users\Ove\paho>git clone https://github.com/eclipse/paho.mqtt.c.git
C:\Users\Ove\paho>cd org.eclipse.paho.mqtt.c.git
C:\Users\Ove\paho>msbuild "Windows Build\Paho C MQTT APIs.sln" /p:Configuration=Release

I'm stuck at msbuild where it repeats a series of errors:

'openssl/ssl.h': No such file or directory

I've installed openssl and there is an environment variable set up in:

C:\OpenSSL-Win32\bin\openssl.cfg

I've tried adding other systems paths like:

C:\Users\Ove\openssl\include\openssl

which is where ssl.h resides
I've also tried sticking the openssl folder in the paho\src folder locally
but I still get these errors

Upvotes: 0

Views: 7920

Answers (1)

zeromus
zeromus

Reputation: 1667

With this commit you can see what's happened

https://github.com/eclipse/paho.mqtt.c/commit/543e761474e4836162a0f4428323173abf2de5ad#diff-0d89939d72d5bb4940c5f129d135d9f4

Windows and MSVC don't have any kind of a system for locating library headers. So naturally, this codebase has its own system for locating the openssl headers which uses an environment variable.

openssl.cfg looks like openssl's own operational configuration, completely unrelated to building anything.

You say you tried "adding" (what does that mean?) C:\Users\Ove\openssl\include\openssl (to what?) which you say is "where ssl.h" resides. So what? Your compiler error isn't telling you it's missing ssl.h. It's telling you it's missing openssl/ssl.h. Perhaps if you "added" C:\Users\Ove\openssl\include which does contain openssl/ssl.h? But I'm not sure how it would have got there unless you copied it around, making things more confusing for yourself.

I'll tell you what I'd do:

set OpenSSLDir=C:\OpenSSL-Win32\include

Putting the openssl folder in paho\src may have worked, if by "openssl folder" you mean C:\OpenSSL-Win32\include\openssl and not C:\OpenSSL-Win32 -- if the project had done the equivalent of -I., meaning that attempts to #include <openssl/ssl.h> from paho\src\SSLSocket.c could find it at paho\src\openssl\ssl.h. However, you can see, the project hasn't done that. Therefore you could add . as an include path and probably make that solution work; or edit the code to #include "openssl/ssl.h" instead.

I've been excruciatingly verbose here because you need to understand how include paths work before you can drop libraries in on windows and combine them all. There's no magic, just simple rules.

Upvotes: 1

Related Questions