Skip to content

Conversation

@DownerCase
Copy link
Contributor

@DownerCase DownerCase commented Apr 4, 2025

Updates asio to 1.34 to resolve build failures when trying to use new versions.

I don't know why I had to increase the test timeout but I can reproduce the failure on master with the asio 1.32. 🤷

Nb: There is still use of deprecated functionality with the data strand .wrap function but it doesn't cause the build to fail.

  • Substituted .wrap for asio::bind_executor and set the compile definition to disallow using deprecated functionality 😄

Closes #30

@DownerCase
Copy link
Contributor Author

@FlorianReimold That should be everything. Would be good to get this and the CMake policy update merged and a new version tagged. I'm working on some packaging stuff currently (for the AUR) and need this repo to be asio 1.34 compatible. 😄

Copy link
Member

@FlorianReimold FlorianReimold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DownerCase: Thanks for taking care of this! I only stumbled across the asio::get_associated_allocator calls. Why do we need those? The returned allocator is not used.

me->synchronous_callback_(data_buffer, header);
});
},
asio::get_associated_allocator(me->data_strand_));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line of code necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the remaining signatures of io_context_strand::post requires an allocator even though the function doesn't use it...

https://github.com/chriskohlhoff/asio/blob/a892f73dc96bfaf92db98a3fe219f920fad007ea/asio/include/asio/io_context_strand.hpp#L174-L193

Looking at the commit that removed the originally used function, it actually says to use asio::post which does not require an allocator.

chriskohlhoff/asio@2f9c4ef#diff-a9951ef828e91a6ea4683ee5f1da1046abaefaa093db694a8a9825a098f50431

Thank you. I will make that change.

me->readHeaderLength();
});
},
asio::get_associated_allocator(me->data_strand_));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line of code necessary?

me->synchronous_callback_ = callback;
});
},
asio::get_associated_allocator(data_strand_));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line of code necessary?

@DownerCase
Copy link
Contributor Author

Ok @FlorianReimold all sorted again. Seems like asio was confusing the 2015 toolchain, didn't dig deep into why but the 2017 toolchain doesn't fail with the same code 🤷

@FlorianReimold
Copy link
Member

VS 2017 toolchain is fine. Asio probably now uses some C++17 features. asio::post is the way to go here, I didn't realize that the get_associated_allocator call were connected to that.

@FlorianReimold FlorianReimold merged commit 3dcb47a into eclipse-ecal:master Apr 9, 2025
14 checks passed
@DownerCase DownerCase deleted the fix_asio_compat branch April 9, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure with asio 1.33 or newer due to removal of deprecated asio::io_service

2 participants