Conan build and SSL support not working
PierreQuebriac opened this issue · 4 comments
Hi, I am trying clickhouse for a robot monitoring project and I consider using the cloud service. But I want to use the SSL encryption before that. My whole project is build with the help of Conan2. And despite the fact that the option with_openssl is set to true and passed correctly to the clickhouse conan recipe, the execution of a simple code with SSL active throw the error: Library was built with no SSL support.
Here is a part of the conan recipe I use :
options = ConanRecipeDev.options
default_options = {
**ConanRecipeDev.default_options,
"stduuid/*:with_cxx20_span": True,
"clickhouse-cpp/*:with_openssl": True,
}
def requirements(self):
self.requires("stduuid/1.2.3")
self.requires("clickhouse-cpp/2.4.0")
super().requirements()
And here is the piece of code that set the client options that throw the error:
clickhouse::ClientOptions options;
options.SetDefaultDatabase(rdm_options.client.default_database);
options.SetUser(rdm_options.client.user);
options.SetPassword(rdm_options.client.password);
options.SetHost(rdm_options.client.host);
options.SetRetryTimeout(rdm_options.client.retry_timeout);
options.SetPingBeforeQuery(rdm_options.client.ping_before_query);
options.SetRethrowException(rdm_options.client.rethrow_exceptions);
options.SetSendRetries(rdm_options.client.send_retries);
clickhouse::ClientOptions::SSLOptions sslOptions;
sslOptions.SetSkipVerification(false);
options.SetSSLOptions(sslOptions);
Am I missing an option or do I set incorrectly the options ?
Thank you for the great work and for the help !
Hi! Not sure, if that could be an issue, but the option name is actually WITH_OPENSSL
(all uppercase): https://github.com/ClickHouse/clickhouse-cpp/blob/master/CMakeLists.txt#L12
Hi, the conan recipe use this uppercase option but its own option is lower case:
conan option
I found a solution to fix my problem
In order to make option from conan to work with cmake, one need to CACHE the options in the CMakeList.txt
Here is an example on how to change the line 12 of the CMakeList.txt to make this work:
option(WITH_OPENSSL "Enable OpenSSL" OFF CACHE BOOL "Enable OpenSSL support")
@Enmk current issue closed by conan-io/conan-center-index#19449