microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
8k stars 1.65k forks source link

Error on build on debian with boost 1.60 and openssl 1.1.0-pre3 #56

Closed eloyleonardo closed 6 years ago

eloyleonardo commented 8 years ago

When i try to compile the library i receive the follow error (looks like it's a problem with the warnings being treated as an error).

It's really this or it's something i made wrong ? How can i solve this ? I already have the openssl and boost installed. Thanks

Here a link to the full error

...

                                                   ^
In file included from /home/devena/libsc/linux/all/include/boost/asio/detail/descriptor_ops.hpp:112:0,
                 from /home/devena/libsc/linux/all/include/boost/asio/detail/reactive_serial_port_service.hpp:28,
                 from /home/devena/libsc/linux/all/include/boost/asio/serial_port_service.hpp:26,
                 from /home/devena/libsc/linux/all/include/boost/asio/basic_serial_port.hpp:30,
                 from /home/devena/libsc/linux/all/include/boost/asio.hpp:26,
                 from /home/devena/srcc/linux/casablanca/Release/include/pplx/threadpool.h:34,
                 from /home/devena/srcc/linux/casablanca/Release/include/cpprest/details/http_server_asio.h:18,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:157,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp: In function ‘int boost::asio::detail::descriptor_ops::close(int, boost::asio::detail::descriptor_ops::state_type&, boost::system::error_code&)’:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp:69:13: error: conversion to ‘boost::asio::detail::descriptor_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion]
       state &= ~non_blocking;
             ^
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp: In function ‘bool boost::asio::detail::descriptor_ops::set_user_non_blocking(int, boost::asio::detail::descriptor_ops::state_type&, bool, boost::system::error_code&)’:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp:114:13: error: conversion to ‘boost::asio::detail::descriptor_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion]
       state &= ~(user_set_non_blocking | internal_non_blocking);
             ^
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp: In function ‘bool boost::asio::detail::descriptor_ops::set_internal_non_blocking(int, boost::asio::detail::descriptor_ops::state_type&, bool, boost::system::error_code&)’:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp:160:13: error: conversion to ‘boost::asio::detail::descriptor_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion]
       state &= ~internal_non_blocking;
             ^
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp: In function ‘int boost::asio::detail::descriptor_ops::ioctl(int, boost::asio::detail::descriptor_ops::state_type&, long int, boost::asio::detail::ioctl_arg_type*, boost::system::error_code&)’:
/home/devena/libsc/linux/all/include/boost/asio/detail/impl/descriptor_ops.ipp:358:15: error: conversion to ‘boost::asio::detail::descriptor_ops::state_type {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion]
         state &= ~(user_set_non_blocking | internal_non_blocking);
               ^
In file included from /home/devena/libsc/linux/all/include/boost/thread/thread_time.hpp:10:0,
                 from /home/devena/libsc/linux/all/include/boost/thread/lock_types.hpp:18,
                 from /home/devena/libsc/linux/all/include/boost/thread/pthread/mutex.hpp:16,
                 from /home/devena/libsc/linux/all/include/boost/thread/mutex.hpp:16,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:82,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/date_time/microsec_time_clock.hpp: In instantiation of ‘static time_type boost::date_time::microsec_clock<time_type>::create_time(boost::date_time::microsec_clock<time_type>::time_converter) [with time_type = boost::posix_time::ptime; boost::date_time::microsec_clock<time_type>::time_converter = tm* (*)(const long int*, tm*); time_t = long int]’:
/home/devena/libsc/linux/all/include/boost/date_time/microsec_time_clock.hpp:76:41:   required from ‘static time_type boost::date_time::microsec_clock<time_type>::universal_time() [with time_type = boost::posix_time::ptime]’
/home/devena/libsc/linux/all/include/boost/thread/thread_time.hpp:22:63:   required from here
/home/devena/libsc/linux/all/include/boost/date_time/microsec_time_clock.hpp:86:36: error: conversion to ‘uint32_t {aka unsigned int}’ from ‘__suseconds_t {aka long int}’ may alter its value [-Werror=conversion]
       boost::uint32_t sub_sec = tv.tv_usec;
                                    ^
In file included from /home/devena/libsc/linux/all/include/boost/date_time/adjust_functors.hpp:13:0,
                 from /home/devena/libsc/linux/all/include/boost/date_time/gregorian/greg_duration_types.hpp:14,
                 from /home/devena/libsc/linux/all/include/boost/date_time/gregorian/gregorian_types.hpp:22,
                 from /home/devena/libsc/linux/all/include/boost/date_time/posix_time/posix_time_config.hpp:18,
                 from /home/devena/libsc/linux/all/include/boost/date_time/posix_time/posix_time_system.hpp:13,
                 from /home/devena/libsc/linux/all/include/boost/date_time/posix_time/ptime.hpp:12,
                 from /home/devena/libsc/linux/all/include/boost/date_time/posix_time/posix_time_types.hpp:12,
                 from /home/devena/libsc/linux/all/include/boost/thread/thread_time.hpp:11,
                 from /home/devena/libsc/linux/all/include/boost/thread/lock_types.hpp:18,
                 from /home/devena/libsc/linux/all/include/boost/thread/pthread/mutex.hpp:16,
                 from /home/devena/libsc/linux/all/include/boost/thread/mutex.hpp:16,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:82,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/date_time/wrapping_int.hpp: In instantiation of ‘IntT boost::date_time::wrapping_int2<int_type_, wrap_min, wrap_max>::calculate_wrap(IntT) [with IntT = short int; int_type_ = short int; int_type_ wrap_min = 1; int_type_ wrap_max = 12]’:
/home/devena/libsc/linux/all/include/boost/date_time/wrapping_int.hpp:126:35:   required from ‘IntT boost::date_time::wrapping_int2<int_type_, wrap_min, wrap_max>::add(IntT) [with IntT = short int; int_type_ = short int; int_type_ wrap_min = 1; int_type_ wrap_max = 12]’
/home/devena/libsc/linux/all/include/boost/date_time/adjust_functors.hpp:77:55:   required from ‘boost::date_time::month_functor<date_type>::duration_type boost::date_time::month_functor<date_type>::get_offset(const date_type&) const [with date_type = boost::gregorian::date; boost::date_time::month_functor<date_type>::duration_type = boost::gregorian::date_duration]’
/home/devena/libsc/linux/all/include/boost/date_time/date_duration_types.hpp:66:49:   required from ‘boost::date_time::months_duration<base_config>::duration_type boost::date_time::months_duration<base_config>::get_offset(const date_type&) const [with base_config = boost::gregorian::greg_durations_config; boost::date_time::months_duration<base_config>::duration_type = boost::gregorian::date_duration; boost::date_time::months_duration<base_config>::date_type = boost::gregorian::date]’
/home/devena/libsc/linux/all/include/boost/date_time/posix_time/date_duration_operators.hpp:33:37:   required from here
/home/devena/libsc/linux/all/include/boost/date_time/wrapping_int.hpp:151:14: error: conversion to ‘boost::date_time::wrapping_int2<short int, 1, 12>::int_type {aka short int}’ from ‘int’ may alter its value [-Werror=conversion]
       value_ -= (wrap_max - wrap_min + 1);
              ^
/home/devena/libsc/linux/all/include/boost/date_time/wrapping_int.hpp:156:14: error: conversion to ‘boost::date_time::wrapping_int2<short int, 1, 12>::int_type {aka short int}’ from ‘int’ may alter its value [-Werror=conversion]
       value_ += (wrap_max - wrap_min + 1);
              ^
In file included from /home/devena/libsc/linux/all/include/boost/asio/detail/impl/posix_mutex.ipp:24:0,
                 from /home/devena/libsc/linux/all/include/boost/asio/detail/posix_mutex.hpp:73,
                 from /home/devena/libsc/linux/all/include/boost/asio/detail/mutex.hpp:25,
                 from /home/devena/libsc/linux/all/include/boost/asio/detail/service_registry.hpp:20,
                 from /home/devena/libsc/linux/all/include/boost/asio/impl/io_service.hpp:19,
                 from /home/devena/libsc/linux/all/include/boost/asio/io_service.hpp:767,
                 from /home/devena/libsc/linux/all/include/boost/asio/ssl/context.hpp:26,
                 from /home/devena/libsc/linux/all/include/boost/asio/ssl.hpp:19,
                 from /home/devena/srcc/linux/casablanca/Release/include/cpprest/http_client.h:65,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:132,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/asio/error.hpp: At global scope:
/home/devena/libsc/linux/all/include/boost/asio/error.hpp:258:45: error: ‘boost::asio::error::system_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& system_category
                                             ^
/home/devena/libsc/linux/all/include/boost/asio/error.hpp:260:45: error: ‘boost::asio::error::netdb_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& netdb_category
                                             ^
/home/devena/libsc/linux/all/include/boost/asio/error.hpp:262:45: error: ‘boost::asio::error::addrinfo_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& addrinfo_category
                                             ^
/home/devena/libsc/linux/all/include/boost/asio/error.hpp:264:45: error: ‘boost::asio::error::misc_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& misc_category
                                             ^
In file included from /home/devena/libsc/linux/all/include/boost/asio/ssl/impl/context.ipp:26:0,
                 from /home/devena/libsc/linux/all/include/boost/asio/ssl/context.hpp:786,
                 from /home/devena/libsc/linux/all/include/boost/asio/ssl.hpp:19,
                 from /home/devena/srcc/linux/casablanca/Release/include/cpprest/http_client.h:65,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:132,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/asio/ssl/error.hpp:34:45: error: ‘boost::asio::error::ssl_category’ defined but not used [-Werror=unused-variable]
 static const boost::system::error_category& ssl_category
                                             ^
In file included from /home/devena/libsc/linux/all/include/boost/system/system_error.hpp:14:0,
                 from /home/devena/libsc/linux/all/include/boost/thread/exceptions.hpp:22,
                 from /home/devena/libsc/linux/all/include/boost/thread/pthread/mutex.hpp:14,
                 from /home/devena/libsc/linux/all/include/boost/thread/mutex.hpp:16,
                 from /home/devena/srcc/linux/casablanca/Release/src/pch/stdafx.h:82,
                 from /home/devena/srcc/linux/casablanca/Release/src/http/client/http_client_msg.cpp:25:
/home/devena/libsc/linux/all/include/boost/system/error_code.hpp:221:36: error: ‘boost::system::posix_category’ defined but not used [-Werror=unused-variable]
     static const error_category &  posix_category = generic_category();
                                    ^
/home/devena/libsc/linux/all/include/boost/system/error_code.hpp:222:36: error: ‘boost::system::errno_ecat’ defined but not used [-Werror=unused-variable]
     static const error_category &  errno_ecat     = generic_category();
                                    ^
/home/devena/libsc/linux/all/include/boost/system/error_code.hpp:223:36: error: ‘boost::system::native_ecat’ defined but not used [-Werror=unused-variable]
     static const error_category &  native_ecat    = system_category();
                                    ^
cc1plus: all warnings being treated as errors
src/CMakeFiles/cpprest.dir/build.make:54: recipe for target 'src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o' failed
make[2]: *** [src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o] Error 1
CMakeFiles/Makefile2:75: recipe for target 'src/CMakeFiles/cpprest.dir/all' failed
make[1]: *** [src/CMakeFiles/cpprest.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
ras0219-msft commented 8 years ago

Which version of Debian are you compiling on and which compiler are you using?

ras0219-msft commented 8 years ago

Also I notice you have a custom version of boost; which versions of openssl and boost are you using?

eloyleonardo commented 8 years ago

I'm using Debian 8.0. And its really a custom version (i'll try to build to multiple platforms), the boost it's version 1.60.0 and the open ssl version it's 1.0-pre2.

Thank you

eloyleonardo commented 8 years ago

First of all i give you the wrong version, i try to use the opensss 1.1.0-pre3 (really sorry about that). And on OS X, I can build with the openssl version 1.0.2e and boost version 1.59.0. I will try to use this versions on Debian and try to compile.

The strange thing on Debian is is. The build operation find the openssl, but complains about the version (tell the version is .0.0) but i can run the openssl and if i set the variable to the right version of openssl the check step pass but stops in the compilation (with those warnings).

Is something i made wrong ? Thanks

ras0219-msft commented 8 years ago

Ok, after looking through the error log, I get this:

PS C:\Users\roschuma\Documents> gc .\linuxmakeerror.txt | select-string "error: " | % { $_ -replace ".+\[(-Werror=.+)\]",'$1' -replace '.+error: (.+)$','$1' } | group | select count,name

Count Name
----- ----
   27 -Werror=conversion
  301 -Werror=cast-qual
    4 -Werror=deprecated-declarations
    1 ‘::SSLv2_method’ has not been declared
    1 ‘::SSLv2_client_method’ has not been declared
    1 ‘::SSLv2_server_method’ has not been declared
   14 invalid use of incomplete type ‘SSL_CTX {aka struct ssl_ctx_st}’
   14 forward declaration of ‘SSL_CTX {aka struct ssl_ctx_st}’
    2 ‘SSL_R_SHORT_READ’ was not declared in this scope
    1 invalid use of incomplete type ‘SSL {aka struct ssl_st}’
    1 forward declaration of ‘SSL {aka struct ssl_st}’
    8 -Werror=unused-variable

Ignoring the warnings-turned-error, the remaining errors look to be surrounding OpenSSL. Could you first try using just boost 1.60 with the version of openssl in the system repos?

kapirajus commented 8 years ago

It seems to be a bug in Boost when complied in C++11 mode.

Go to Release/src/CMakeLists.txt, line 56 and remove -Werror. The flag instructs to treat warnings as errors. You may get rid of errors, but there will be lots of warnings.

You need to run tests to ensure correctness of code dealing with date-time.

damienhocking commented 8 years ago

We've seen the same thing. So far in all our tests everything still runs fine.

Damien

On 4/28/2016 9:30 AM, Venkateswara Rao Sanaka (Venkata Ramana) wrote:

It seems to be a bug in Boost when complied in C++11 mode.

Go to Release/src/CMakeLists.txt, line 56 and remove -Werror. The flag instructs to treat warnings are errors. You may get rid of errors, but there will be lots of warnings.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/Microsoft/cpprestsdk/issues/56#issuecomment-215467914

Damien Hocking, PhD CEO, Corelium Software t: 403 510 6619 e: dhocking@coreliuminc.com w: http://coreliuminc.com

LocutusOfBorg commented 8 years ago

This is going to be a problem in Debian, because they want openssl 1.1 inside Stretch (new stable release)

ras0219-msft commented 8 years ago

Has Boost been updated to support OpenSSL 1.1? I believe we should "just work" once that happens.

LocutusOfBorg commented 7 years ago

Boost 1.62 works with OpenSSL 1.1, but now we have two other issues: https://github.com/zaphoyd/websocketpp/issues/599 https://github.com/Microsoft/cpprestsdk/issues/279

G.

lukeocamden commented 6 years ago

Would it be best to ignore warnings originating from boost? That way cpprestsdk can remain compatible with whatever boost/openssl versions, and still require -Werror for its own code.

Specifically, in Release/cmake/cpprest_find_boost.cmake, "SYSTEM" would be passed to target_include_directories like this:

    target_include_directories(cpprestsdk_boost_internal SYSTEM INTERFACE "$<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>")