cpprestsdk icon indicating copy to clipboard operation
cpprestsdk copied to clipboard

Boost and ssl problems on cpprestsdk build

Open Dainerx opened this issue 6 years ago • 1 comments

I'm failing to build cpprest on my elementary OS.

g++ -v

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)

dpkg -s libboost-dev | grep 'Version'

Version: 1.58.0.1ubuntu1

dpkg -s cmake | grep 'Version'

Version: 3.5.1-1ubuntu3

openssl version -a

OpenSSL 1.1.1 11 Sep 2018 (Library: OpenSSL 1.1.1b 26 Feb 2019)

When I run ninja I get countless errors on boost ssl and openssl directories. The following in not the entirety of the errors:

[1/159] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o
FAILED: Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o 
/usr/bin/c++   -DCPPREST_EXCLUDE_BROTLI=1 -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -Dcpprest_EXPORTS -I../Release/include -I../Release/src/pch -std=c++11 -fno-strict-aliasing -g -fPIC   -Werror -pedantic -Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code -MMD -MT Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o -MF Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o.d -o Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o -c ../Release/src/http/common/http_helpers.cpp
In file included from /usr/include/openssl/bio.h:20:0,
                 from /usr/include/openssl/conf.h:13,
                 from /usr/include/boost/asio/ssl/detail/openssl_types.hpp:19,
                 from /usr/include/boost/asio/ssl/context_base.hpp:19,
                 from /usr/include/boost/asio/ssl/context.hpp:27,
                 from /usr/include/boost/asio/ssl.hpp:19,
                 from ../Release/include/cpprest/http_client.h:68,
                 from ../Release/src/pch/stdafx.h:101,
                 from ../Release/src/http/common/http_helpers.cpp:14:
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp: In constructor ‘boost::asio::ssl::detail::openssl_init_base::do_init::do_init()’:
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp:43:23: error: expected id-expression before ‘(’ token
     mutexes_.resize(::CRYPTO_num_locks());
                       ^
In file included from /usr/include/boost/asio/ssl/detail/openssl_init.hpp:100:0,
                 from /usr/include/boost/asio/ssl/context.hpp:29,
                 from /usr/include/boost/asio/ssl.hpp:19,
                 from ../Release/include/cpprest/http_client.h:68,
                 from ../Release/src/pch/stdafx.h:101,
                 from ../Release/src/http/common/http_helpers.cpp:14:
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp:46:66: error: expected id-expression before ‘;’ token
     ::CRYPTO_set_locking_callback(&do_init::openssl_locking_func);
                                                                  ^
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp:47:56: error: expected id-expression before ‘;’ token
     ::CRYPTO_set_id_callback(&do_init::openssl_id_func);
                                                        ^
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp: In destructor ‘boost::asio::ssl::detail::openssl_init_base::do_init::~do_init()’:
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp:64:32: error: expected id-expression before ‘;’ token
     ::CRYPTO_set_id_callback(0);
                                ^
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp:65:37: error: expected id-expression before ‘;’ token
     ::CRYPTO_set_locking_callback(0);
                                     ^
In file included from /usr/include/openssl/engine.h:25:0,
                 from /usr/include/boost/asio/ssl/detail/openssl_types.hpp:22,
                 from /usr/include/boost/asio/ssl/context_base.hpp:19,
                 from /usr/include/boost/asio/ssl/context.hpp:27,
                 from /usr/include/boost/asio/ssl.hpp:19,
                 from ../Release/include/cpprest/http_client.h:68,
                 from ../Release/src/pch/stdafx.h:101,
                 from ../Release/src/http/common/http_helpers.cpp:14:
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp:66:7: error: expected id-expression before ‘while’
     ::ERR_free_strings();
       ^
In file included from /usr/include/openssl/x509.h:18:0,
                 from /usr/include/openssl/ssl.h:20,
                 from /usr/include/boost/asio/ssl/detail/openssl_types.hpp:20,
                 from /usr/include/boost/asio/ssl/context_base.hpp:19,
                 from /usr/include/boost/asio/ssl/context.hpp:27,
                 from /usr/include/boost/asio/ssl.hpp:19,
                 from ../Release/include/cpprest/http_client.h:68,
                 from ../Release/src/pch/stdafx.h:101,
                 from ../Release/src/http/common/http_helpers.cpp:14:
/usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp:72:7: error: expected id-expression before ‘while’
     ::EVP_cleanup();
       ^

I guess this is not mainly a cpprestsdk issue but more of boost and ssl. Although I'm wondering, what is exactly causing this and how can I proceed to fix it so I can build cpprest.

Dainerx avatar May 07 '19 10:05 Dainerx

Its happening mostly due to two version of boost being installed on the host. The older one containing the older ssl code and hence generating all these errors.

StrikeCPP avatar Jun 22 '21 04:06 StrikeCPP