-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support onetbb and boost 1.87.0 on FreeBSD #1459
base: RB-10.5
Are you sure you want to change the base?
Conversation
I tried to run some tests, but serialising and deserialising test failed.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR - being able to build against more recent Boost/TBB will be great.
I've made several comments inline on the Boost changes, as I think we can achieve what we want without having two code paths - we use a recent enough boost that the new code will work with our version too. Having just one code path makes things simpler and much easier to maintain.
I haven't reviewed the TBB changes in any detail, because we won't be able to maintain two code paths there - the code is too complex to even consider it. What we need is a single version that will work with either TBB version (possibly with very small, isolated #if
blocks). I would also want to split these changes out into separate commits - one commit per topic makes things easier to review and debug.
If you are willing, I suggest we focus on simplifying the Boost changes and getting those merged on their own first. Then once we have that established we can look at the thornier issue of TBB.
Many thanks once again,
John
@@ -48,8 +48,15 @@ | |||
|
|||
#include "boost/format.hpp" | |||
|
|||
#include <tbb/version.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tbb/version.h
header doesn't seem to exist in TBB 2020, so is breaking the build here :
src/IECore/IndexedIOAlgo.cpp:36:10: fatal error: tbb/version.h: No such file or directory
36 | #include <tbb/version.h>
#include <boost/version.hpp> | ||
#if BOOST_VERSION >= 107000 | ||
#include <boost/timer/timer.hpp> | ||
#else | ||
#include <boost/timer.hpp> | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not actually using boost::timer
in this file, so we can simply delete the include instead.
#include <boost/version.hpp> | ||
#if BOOST_VERSION >= 106600 | ||
#include <boost/asio.hpp> | ||
#include <boost/asio/io_context.hpp> | ||
#else | ||
#include <boost/asio.hpp> | ||
#include <boost/asio/io_service.hpp> | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this change is necessary - in both boost versions, asio.hpp
includes everything.
#if BOOST_VERSION >= 106600 | ||
boost::asio::io_context m_service; | ||
#else | ||
boost::asio::io_service m_service; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be simpler. io_context
is available in 1.80 (the version we're building with), and io_service
is just a typedef referencing it. So I think we can just change to io_context
unconditionally, and have one version of the code that works for both boost versions.
#if BOOST_VERSION >= 106600 | ||
boost::asio::io_context io_context; | ||
tcp::resolver resolver(io_context); | ||
boost::system::error_code error; | ||
auto endpoints = resolver.resolve(m_data->m_host, m_data->m_port, error); | ||
|
||
if (!error) | ||
{ | ||
error = boost::asio::error::host_not_found; | ||
for (auto it = endpoints.begin(); it != endpoints.end() && error; ++it) | ||
{ | ||
m_data->m_socket.close(); | ||
m_data->m_socket.connect(*it, error); | ||
} | ||
} | ||
|
||
if (error) | ||
{ | ||
throw Exception("Could not connect to remote display driver server: " + error.message()); | ||
} | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above, I think we should be able to have one version of the code here, that works for both Boost versions.
#if BOOST_VERSION >= 106600 | ||
class DisplayDriverServer::Session : public RefCounted | ||
{ | ||
public: | ||
|
||
Session( boost::asio::io_context& io_service, MergeMap& mergeMap ); | ||
~Session() override; | ||
|
||
boost::asio::ip::tcp::socket& socket(); | ||
void start(); | ||
|
||
private: | ||
|
||
void handleReadHeader( const boost::system::error_code& error ); | ||
void handleReadOpenParameters( const boost::system::error_code& error ); | ||
void handleReadDataParameters( const boost::system::error_code& error ); | ||
void sendResult( DisplayDriverServerHeader::MessageType msg, size_t dataSize ); | ||
void sendException( const char *message ); | ||
|
||
private: | ||
boost::asio::ip::tcp::socket m_socket; | ||
DisplayDriverPtr m_displayDriver; | ||
DisplayDriverServerHeader m_header; | ||
CharVectorDataPtr m_buffer; | ||
MergeMap& m_mergeMap; | ||
std::optional<int> m_mergeId; | ||
}; | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be too hard to maintain this amount of almost-identical code in separate #if
blocks. As above, I think we can simply change to io_context
unconditionally.
#include "boost/filesystem/convenience.hpp" | ||
#if BOOST_VERSION >= 108500 | ||
#include <boost/filesystem/path.hpp> | ||
#else | ||
#include <boost/filesystem/convenience.hpp> | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just drop the convenience.hpp
include completely - see below.
@@ -87,8 +91,11 @@ bool FileNameParameter::valueValid( const Object *value, std::string *reason ) c | |||
// extensions check | |||
if( extensions().size() ) | |||
{ | |||
#if BOOST_VERSION >= 108500 | |||
string ext = boost::filesystem::path(boost::filesystem::path( s->readable())).extension().string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this line will work in Boost 1.80 as well, so we can simply replace the old code completely. I think we have one-too-many boost::filesystem::path()
calls though - we only need one.
Generally describe what this PR will do, and why it is needed.
I added support for onetbb (Tested with onetbb 2022.0.0)
I added support for boost 1.87.0 (Tested with boost 1.87.0)
I tested on FreeBSD 14.2 amd64 and clang 18
Related Issues
Dependencies
Breaking Changes
I added support for onetbb (Tested with onetbb 2022.0.0)
I added support for boost 1.87.0 (Tested with boost 1.87.0)
I tried to test with the test suite, but I don't know which python library to install (imath python library)
It is an attempt for convert to modern onetbb
Checklist