Azure / azure-sdk-for-cpp

This repository is for active development of the Azure SDK for C++. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-cpp.
MIT License
179 stars 128 forks source link

Fix cmake build with custom OpenSSL library #2716

Closed kshcherbatov closed 3 years ago

kshcherbatov commented 3 years ago

Describe the bug To compile dynamic Azure SDK libraries I link them against certain OpenSSL distributed with our product:

$ /snap/cmake/912/bin/cmake .. -DOPENSSL_ROOT_DIR=$TREASURE_ROOT/OpenSSL/1.1.1  -DOPENSSL_INCLUDE_DIR=$TREASURE_ROOT/OpenSSL/1.1.1/include -DOPENSSL_CRYPTO_LIBRARY=$TREASURE_ROOT/OpenSSL/1.1.1/a64_lnx/lib/libcrypto.so.1.1 -DOPENSSL_SSL_LIBRARY=$TREASURE_ROOT/OpenSSL/1.1.1/a64_lnx/lib/libssl.so.1.1 -DCMAKE_INSTALL_PREFIX=$TREASURE_ROOT/Azure/main/ -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DAZ_ALL_LIBRARIES=OFF

$ make clean
$ make -j5
In file included from /home/hadoop/Desktop/azure-sdk-for-cpp/sdk/core/azure-core/inc/azure/core/http/policies/policy.hpp:17:0,
                 from /home/hadoop/Desktop/azure-sdk-for-cpp/sdk/core/azure-core/inc/azure/core/internal/client_options.hpp:13,
                 from /home/hadoop/Desktop/azure-sdk-for-cpp/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/cryptography/cryptography_client_options.hpp:13,          
                 from /home/hadoop/Desktop/azure-sdk-for-cpp/sdk/keyvault/azure-security-keyvault-keys/src/cryptography/cryptography_client_options.cpp:4:
/home/hadoop/Desktop/azure-sdk-for-cpp/sdk/core/azure-core/inc/azure/core/uuid.hpp:20:10: fatal error: openssl/rand.h: No such file or directory
 #include <openssl/rand.h> //for RAND_bytes

Here is a git format-patch output for the one-liner-fix proposed: 0001-Fix-cmake-build-with-custom-OpenSSL-library.patch.txt

Jinming-Hu commented 3 years ago

Is this the same issue as https://github.com/Azure/azure-sdk-for-cpp/issues/2560?

If so, I believe this should be handled by core sdk team, rather than engsys.

kshcherbatov commented 3 years ago

The #2560 diff s/PRIVATE/PUBLIC also helps me.