Clang 14 and 15 build error
ivan-volnov opened this issue · 11 comments
Hello. Thanks for the library!
asio-grpc/src/agrpc/detail/memory_resource.hpp:26:10: fatal error: 'memory_resource' file not found
#include <memory_resource>
^~~~~~~~~~~~~~~~~
1 error generated.
I have this include in #include <experimental/memory_resource>
When using clang+libc++ you can tell asio-grpc to utilize Boost.Container instead of <memory_resource>
. See Usage in the README. For example, vcpkg with standalone asio would look like this:
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "test",
"version": "0.1.0",
"dependencies": [
{
"name": "asio-grpc",
"features": [
"boost-container"
]
},
"asio"
]
}
Thanks, I have seen it. But I hoped to use it without Boost. Purely with standalone asio. May be add another option for experimental prefix?
Sure, I can look into it. experimental/memory_resource won't work however, because it does not contain unsynchronized_pool_resource. I could use something like recycling_allocator instead.
Yes, you are right, experimental/memory_resource doesn't contain unsynchronized_pool_resource.
Unfortunately recycling_allocator is not a big deal either because of Boost dependency.
Will look for another workaround.
Tried to update clang to 15. No luck.
The work on memory_resource has been abandoned in clang:
https://quuxplusone.github.io/blog/2018/06/05/libcpp-memory-resource/
Oh the recycling_allocator is part of Asio, which means it is also available in standalone asio: https://think-async.com/Asio/asio-1.24.0/doc/asio/reference/recycling_allocator/recycling_allocator.html
Well, it would be great! Looking forward for the commit =)
Master branch now contains an option to enable the use of recycling_allocator:
set(ASIO_GRPC_USE_RECYCLING_ALLOCATOR on)
set(ASIO_GRPC_USE_BOOST_CONTAINER off)
add_subdirectory(/path/to/repository/root)
Version 2.4.0 has been released containing this feature. I also simplified it such that
set(ASIO_GRPC_USE_RECYCLING_ALLOCATOR on)
add_subdirectory(/path/to/repository/root)
should do the trick. Let me know if everything works as you expect.
Hi @ivan-volnov,
have you found some time to test the new feature, does it work as you expect? If so, could you close the issue please?
Hi @Tradias,
Thank you very much for fixing the issue.
I ended up with writing my own small one-file implementation of the library using your old blog post. Thanks a lot for this!
So, I can't test it anymore...
I don't use the code I don't understand or that has a lot of redundant stuff.
My recommendations are: refactor the library, make it small and easy as possible.
Glad to hear that my blog post was helpful.
In the immediate future I plan on adding a Tutorial section to the documentation, but aimed at users more than maintainers. Nonetheless, it might shed some light on the complexity in some parts of the library. For v3 I also plan on removing some parts of the public API and simplify things like repeatedly_request
.
With libraries it is always a tricky dance between genericity and focus.