Petr Mánek created THRIFT-5785:
----------------------------------

             Summary: TTransportException.h includes 
'boost/numeric/conversion/cast.hpp' without target depending on Boost
                 Key: THRIFT-5785
                 URL: https://issues.apache.org/jira/browse/THRIFT-5785
             Project: Thrift
          Issue Type: Bug
    Affects Versions: 0.20.0
         Environment: * macOS 14 (Sonoma)
 * Host is x86_64, cross-compiling universal binaries for x86_64+aarch64
 * CMake 3.29, dependencies managed through conventional use of find_package()
 * AppleClang 15.0.0.15000100
 * Compiling with -std=gnu++20
 * Boost 1.81 (from MacPorts)
 * Apache Thrift 0.20 (from MacPorts, recently upgraded)
            Reporter: Petr Mánek


Hello, ever since upgrading from version 0.19 to 0.20, I am seeing a new error 
when compiling my Thrift-based software:

```
In file included from /redacted/RemoteControl.h:10:
In file included from /opt/local/lib/../include/thrift/TDispatchProcessor.h:22:
In file included from /opt/local/lib/../include/thrift/TProcessor.h:24:
In file included from /opt/local/lib/../include/thrift/protocol/TProtocol.h:46:
In file included from 
/opt/local/lib/../include/thrift/transport/TTransport.h:23:
/opt/local/lib/../include/thrift/Thrift.h:54:19: warning: 
'iterator<std::forward_iterator_tag, std::pair<int, const char *>>' is 
deprecated [-Wdeprecated-declarations]
    : public std::iterator<std::forward_iterator_tag, std::pair<int, const 
char*> > {
                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__iterator/iterator.h:24:29:
 note: 'iterator<std::forward_iterator_tag, std::pair<int, const char *>>' has 
been explicitly marked deprecated here
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__config:862:41:
 note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
#    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
                                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__config:835:49:
 note: expanded from macro '_LIBCPP_DEPRECATED'
#      define _LIBCPP_DEPRECATED __attribute__((deprecated))
                                                ^
In file included from 
/Users/admin/builds/dUGYoT7P/0/acquisition-framework/tracklab/build/plugins/microdaq/thrift/RemoteControl.cpp:7:
In file included from 
/Users/admin/builds/dUGYoT7P/0/acquisition-framework/tracklab/build/plugins/microdaq/thrift/RemoteControl.h:10:
In file included from /opt/local/lib/../include/thrift/TDispatchProcessor.h:22:
In file included from /opt/local/lib/../include/thrift/TProcessor.h:24:
In file included from /opt/local/lib/../include/thrift/protocol/TProtocol.h:46:
In file included from 
/opt/local/lib/../include/thrift/transport/TTransport.h:25:
/opt/local/lib/../include/thrift/transport/TTransportException.h:23:10: fatal 
error: 'boost/numeric/conversion/cast.hpp' file not found
#include <boost/numeric/conversion/cast.hpp>
```

I have confirmed that 'cast.hpp' is correctly installed in my system, but for 
some reason CMake does not add its include path to compiler invocation, so the 
file is not seen during compilation. Furthermore, based on synthesized compiler 
flags it seems that Thrift's CMake package does not declare public dependency 
on boost::numeric, but nonetheless includes it in public headers. This may be 
related to THRIFT-5660.

For now I mitigate this issue by making my CMake target explicitly depend on 
Apache Thrift as well as boost::numeric. However, since I do not directly use 
Boost whereas Thrift does, I should not have to do that. Instead, it seems much 
more cleaner to me if Thrift publicly depended on boost::numeric or removed the 
offending #include directive from its public headers.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to