Skip to content
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 for boost asio #490

Closed
nlyan opened this issue Jun 29, 2022 · 8 comments · Fixed by #790
Closed

Support for boost asio #490

nlyan opened this issue Jun 29, 2022 · 8 comments · Fixed by #790
Labels
discussion The viability / implementation of the issue is up for debate feature Code based project improvement

Comments

@nlyan
Copy link

nlyan commented Jun 29, 2022

Hi guys,

What's the story with 3a48507? Is the Boost version of ASIO no longer going to be supported?

It would be preferable in my view, given that Boost is a dependency for so many code bases for other reasons, that the Boost flavor is still supported, otherwise you're just forcing an additional dependency on users.

@The-EDev The-EDev added the question Issue can be closed by providing information label Jun 29, 2022
@The-EDev
Copy link
Member

Well The commit you're referencing is part of #482 which is a follow up to #457.

And while I wouldn't use the word support (since Crow is using, not supporting a dependency), yes, the idea is to get off of boost and use the standalone ASIO library instead.

I understand that since some people have boost, why bother installing ASIO. But there are also 2 other categories of people, one that doesn't have boost installed, and another that dislikes boost for being a massive package.

I would love to flip a switch and have both versions working, unfortunately if you look at #457, it is not at all the case.

@nlyan
Copy link
Author

nlyan commented Jun 29, 2022

A lot of the deboostification is about migration to std:: so, makes a lot of sense.

However, Boost.ASIO and vanilla ASIO are esseentially 100% compatible. It seems like the extra work in supporting both would be relatively minor, perhaps just shuffling some includes around, and adding some ifdef's or namespace aliases.

WebSocket++ does this here: https://github.com/zaphoyd/websocketpp/blob/1b11fd301531e6df35a6107c1e8665b1e77a2d8e/websocketpp/common/asio.hpp#L45

Only supporting vanilla asio makes it much more difficult for Crow to share an io_context with other ASIO libraries (e.g. Boost.Beast or RPC frameworks like asio-grpc etc. It also means any future work on asynchronous handlers will be less useful (because you won't be able to compose asynchronous operations with service code that uses Boost.ASIO)

Integrating libraries using different event loop implementations is tricky and painful, and Crow doesn't expose interfaces for making this possible.

Looking at asio vanilla, at just one distro (Manjaro/Arch)

  • ASIO is stable at 1.20.x but Boost is stable at 1.79.x (which incorporates asio 1.22.x).
  • The Boost package is used by 253 other packages
  • The naked asio package is only used by just 8 packages, one of which is WebSocket++

@luca-schlecker
Copy link
Collaborator

As the author of the #457 and the follow-up #482 PR, I'll just throw in my opinion too.

I've generally disliked using Boost due to its sheer size. Asio is a part of it, but the rest just isn't needed for Crow, as it can just rely on standard features. That's why I made the push away from Boost as a dependency in favor of standalone Asio.

I agree with you that supporting both would be really cool though.
It doesn't feel like too much work to get both up and running. I'll take a look at it when I find the necessary time as there currently are other things I am working on, but it's on my list.

@The-EDev The-EDev added feature Code based project improvement and removed question Issue can be closed by providing information labels Jun 30, 2022
@The-EDev The-EDev changed the title Boost.ASIO not to be supported? Support for boost asio Jun 30, 2022
@TheQue42
Copy link

TheQue42 commented Feb 3, 2023

Trying to understand the above discussion, and sorry if this doesnt belong here, but the https://crowcpp.org/master/getting_started/setup/linux/ says nothing about boost is required, but I cant cmake/make without boost?

@xia-stan
Copy link
Contributor

xia-stan commented Mar 3, 2023

I belong in the camp that doesn't have boost installed by default. The move to the standalone ASIO was great for me as I could drop 37 header dependencies from my project. One thing to note is that the ASIO Standalone (boost dependency free) may not be supported in the future. See chriskohlhoff/asio#1208.

@TheQue42 : I ran into a similar problem in #585. If you're using HEAD then, you no longer need boost. You will need the headers from the ASIO repo. When building make sure your compiler include path can find the headers, and pass the -DASIO_STANDALONE flag.

@8188
Copy link

8188 commented Jun 17, 2023

Thanks for xia-stan, I finally comiple helloworld example as
g++ helloworld.cpp -o helloworld -DASIO_STANDALONE -I..\include -ID:\asio-master\asio\include -lws2_32 -lwsock32
on windows10 with mingw32.

@jbulow
Copy link

jbulow commented Feb 20, 2024

Any update on this? Really unfortunate Crow can't be used with an existing code base already having boost as a dependency.

@gittiver
Copy link
Member

No. Actually there are no plans to support boost, but if you need it, feel free to add a pull request containing support for boost::asio.

@gittiver gittiver added the discussion The viability / implementation of the issue is up for debate label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion The viability / implementation of the issue is up for debate feature Code based project improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants