OpenSSL errors when compiling SDK with VS2015

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
Alex76Esa
Jr. Member
Jr. Member
Posts: 4
Joined: 16 Oct 2023, 14:46

OpenSSL errors when compiling SDK with VS2015

Post by Alex76Esa »

Good morning,
I downloaded the latest version of UaStack SDK (1.8.6-641), and a precompiled version of OpenSSL 1.1.1w, finally when compiling with VS2015 a lot of OpenSSL defines are undefined generates me a lot of errors.

There are the steps I made:
  • unzipped SDK in the main root C:\uasdkcppbundle-src-windows-1.8.6-641
  • unzipped the OpenSSL precompiled package in the folder "C:\uasdkcppbundle-src-windows-1.8.8-641\third-party\win32\vs2015\openssl"
  • using cmake 3.28.1 I made a new build for VS2015, following instructions from https://documentation.unified-automation.com/uasdkcpp/1.8.6/html/CompileSdkVS.html
  • then I open the VS2015 solution and make INSTALL build
The output from VS2015 give me this result:

Code: Select all

1>------ Build started: Project: uapkicpp, Configuration: Release Win32 ------
2>------ Build started: Project: uastack, Configuration: Release Win32 ------
1>  uapkicertificate.cpp
1>  uapkiprivatekey.cpp
1>  uapkipublickey.cpp
1>  uapkirevocationlist.cpp
2>  opcua_p_openssl.c
2>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uastack\platforms\win32_v6\opcua_p_openssl.c(121): error C2065: 'CRYPTO_LOCK': undeclared identifier
2>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uastack\platforms\win32_v6\opcua_p_openssl.c(208): error C2065: 'SSLEAY_VERSION': undeclared identifier
2>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uastack\platforms\win32_v6\opcua_p_openssl.c(213): error C2065: 'SSLEAY_CFLAGS': undeclared identifier
2>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uastack\platforms\win32_v6\opcua_p_openssl.c(217): error C2065: 'SSLEAY_BUILT_ON': undeclared identifier
2>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uastack\platforms\win32_v6\opcua_p_openssl.c(221): error C2065: 'SSLEAY_PLATFORM': undeclared identifier
2>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uastack\platforms\win32_v6\opcua_p_openssl.c(225): error C2065: 'SSLEAY_DIR': undeclared identifier
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkipublickey.cpp(139): error C3861: 'ERR_load_crypto_strings': identifier not found
1>  uapkirsakeypair.cpp
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkiprivatekey.cpp(368): error C3861: 'ERR_load_crypto_strings': identifier not found
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkirevocationlist.cpp(192): error C3861: 'BN_hex2bn': identifier not found
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkirevocationlist.cpp(205): error C3861: 'BN_free': identifier not found
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkirevocationlist.cpp(808): error C3861: 'ERR_load_crypto_strings': identifier not found
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkirsakeypair.cpp(540): error C3861: 'ERR_load_crypto_strings': identifier not found
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkicertificate.cpp(370): error C3861: 'ERR_load_crypto_strings': identifier not found
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkicertificate.cpp(1335): error C3861: 'BN_bn2hex': identifier not found
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkicertificate.cpp(1342): error C3861: 'BN_free': identifier not found
1>C:\uasdkcppbundle-src-windows-v1.8.6-641\src\uabase\uapkicpp\uapkicertificate.cpp(2999): error C3861: 'ERR_load_crypto_strings': identifier not found
3>------ Skipped Build: Project: INSTALL, Configuration: Release Win32 ------
3>Project not selected to build for this solution configuration 
========== Build: 0 succeeded, 2 failed, 8 up-to-date, 1 skipped ==========
Can someone help me to find the solution please?
Last edited by Alex76Esa on 12 Mar 2025, 09:36, edited 1 time in total.

Alex76Esa
Jr. Member
Jr. Member
Posts: 4
Joined: 16 Oct 2023, 14:46

Re: OpenSSL errors when compiling SDK with VS2015

Post by Alex76Esa »

The Cmake configuration give me this output:

Code: Select all

CMake Warning (dev) at CMakeLists.txt:1 (project):
cmake_minimum_required() should be called prior to this top-level project() call.  Please see the cmake-commands(7) manual for usage documentation of both commands. This warning is for project developers.  Use -Wno-dev to suppress it.
######################### Creating Makefile of uasdk_src ###########################################
Detected MSVC version: 19.0.24215.1
######################### Creating Makefile of uastack #############################################
### General settings 
UASTACK_PLATFORM                               win32_v6
UASTACK_WITH_OPENSSL                         ON
UASTACK_WITH_HTTPS                            OFF
UASTACK_WITH_HTTP_GET                             OFF
UASTACK_HAVE_THREADS                              ON
UASTACK_USE_THREADS                               ON
UASTACK_USE_SYNCHRONIZATION                       ON
UASTACK_USE_TRACE_RAW                             ON
UASTACK_GUID_STRING_USE_CURLYBRACE                ON
UASTACK_ENABLE_KEYLOGGING                         OFF
### Build settings 
BUILD_SHARED_STACK                                ON
UASTACK_SUPPORT_ENC_OBJ_EXTENSIONS                ON
UASTACK_DISABLE_PUBSUBCONFIGURATIONREFTYPES       OFF
UASTACK_STATIC_PLATFORM                       ON
UASTACK_CLIENTAPI_ENABLED                     ON
UASTACK_SERVERAPI_ENABLED                     ON
### Minimal options 
UASTACK_MINIMAL_OMIT_TYPE_NAME            OFF
UASTACK_MINIMAL_SMALL_VARIANT             OFF
UASTACK_MINIMAL_SMALL_DATAVALUE           OFF
UASTACK_MINIMAL_DISABLE_TRACE              OFF
### Security settings 
UASTACK_SUPPORT_SECURITYPOLICY_NONE               ON
UASTACK_SUPPORT_SECURITYPOLICY_BASIC128RSA15      ON
UASTACK_SUPPORT_SECURITYPOLICY_BASIC256           ON
UASTACK_SUPPORT_SECURITYPOLICY_BASIC256SHA256     ON
UASTACK_SUPPORT_SECURITYPOLICY_AES128SHA256RSAOAEPOFF
UASTACK_SUPPORT_SECURITYPOLICY_AES256SHA256RSAPSS OFF
UASTACK_WITH_TLS                                  OFF
UASTACK_WITH_PKI_WIN32                            OFF
UASTACK_OPENSSL_API_MAJOR                         1
UASTACK_OPENSSL_API_MINOR                         1
### Advanced settings 
UASTACK_TCPLISTENER_MAX_CONNECTIONS               102
UASTACK_NUMBER_OF_AVAILABLE_TIMERS                200
UASTACK_SOCKETMANAGER_NUMBER_OF_SOCKETS           105
UASTACK_ASYNC_OPENSECURECHANNEL                   ON
######################### Creating Makefile of uabasecpp ###########################################
######################### Creating Makefile of uapkicpp ############################################
######################### Creating Makefile of xmlparsercpp ########################################
######################### Creating Makefile of uaclientcpp #########################################
######################### Creating Makefile of coremodule ##########################################
######################### Creating Makefile of uamodule ############################################
######################### Creating Makefile of uamodels ############################################
######################### Project Configuration Summary ############################################
UaOpenSSL                                         found (1.1.1w)
LibXml2                                           found (2.13.5)
CMAKE_BUILD_TYPE                                  Not defined
### Product to build 
### Modules to build 
BUILD_UAPKICPP                                    ON
UASDK_WITH_XMLPARSER                              ON
BUILD_UACLIENTCPP                                 ON
BUILD_UASERVERCPP                                 ON
BUILD_UAMODULE                                    ON
BUILD_UAMODELS                                    ON
### Options to build 
BUILD_TESTING                                     Not defined
BUILD_SHARED_LIBS                                 ON
### End of Summary 
Configuring done (0.3s)

User avatar
Support Team
Hero Member
Hero Member
Posts: 3265
Joined: 18 Mar 2011, 15:09

Re: OpenSSL errors when compiling SDK with VS2015

Post by Support Team »

Hi,

the CMake output seems to be fine, the (rather simple) logic detects the v1.1.1w in the search location. Even though not understand why you switch off the good security policies, the configuration generally looks good.

The OpenSSL that you have precompiled and unziped to the target folder, where did you get that from? It seems that essential parts are missing, which cause the compiler errors.
Best regards
Unified Automation Support Team

Alex76Esa
Jr. Member
Jr. Member
Posts: 4
Joined: 16 Oct 2023, 14:46

Re: OpenSSL errors when compiling SDK with VS2015

Post by Alex76Esa »

Support Team wrote:
12 Mar 2025, 10:07
Hi,

the CMake output seems to be fine, the (rather simple) logic detects the v1.1.1w in the search location. Even though not understand why you switch off the good security policies, the configuration generally looks good.
I haven't touched any cmake options in general, except the BUILD_SHARED_LIBS and CMAKE_INSTALL_PREFIX options.. but I can enabled this option you mentioned.
Support Team wrote:
12 Mar 2025, 10:07
The OpenSSL that you have precompiled and unziped to the target folder, where did you get that from?
https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-1.1.1w.zip
Support Team wrote:
12 Mar 2025, 10:07
It seems that essential parts are missing, which cause the compiler errors.
I also think that this is the problem because without OPEN_SSL enabled everything compiles correctly
Can you provide me with a valid link for a precompiled 1.1.1 win32 version?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3265
Joined: 18 Mar 2011, 15:09

Re: OpenSSL errors when compiling SDK with VS2015

Post by Support Team »

Hi,

the OpenSSL has several deprecated APIs. To gain backward compatibility (down to 0.9.8) there are some macros mapping names. It seems that the "FireDaemon" has provided the pre-compiled binaries without having the backward compatibility switched on.

For that reason you are getting compiler errors (the header files have been found, which is good), but the backward compatibility macros have not been activated, which gives the compiler errors.

Now there are 3 options for you to move forward.
1) use OpenSSL v3.0.x instead (using the newer APIs in OpenSSL)
2) compile the OpenSSL v1.1.1 from source (and switch on deprecated API, to get the macros activated)
3) ask the FireDaemon for new binary edition with backward compatibility switched "on"

Note: there is another 4. option, using the old macros in our stack code, by modifying the conditional version <=3.0 define, but that would not be recommended (and overwritten with next SDK update). My recomendation would be using option 1) because putting efforts in fixing macros in EoL crypto lib, makes no sense.
Best regards
Unified Automation Support Team

Post Reply