I don’t know if this is true but such a thing actually exists already:
- https://www.youtube.com/watch?v=f_D-wD1EmWk
- https://github.com/whoshuu/cpr
Thomas
Boost.Context only builds for mingw if you have a MSVC assembler. Now, RedHat patches it, so Boost.Context can be built on RedHat(or CentOS). However, the author has refused to accept those patches unfortunately. When I build boost on ubuntu for mingw, I disable Boost.Context, which would mean disabling Boost.Beast as well.
Also, Boost.Asio works fine as it doesn’t use Boost.Coroutine nor Boost.Context. I think it provides its own stackless-based coroutines.
Paul
Ok, will do.
>
>> Also, looking at the cmake, it looks like you use coroutines.
>
> Beast is header-only, the Jamfile and CMakeLists.txt are only for
> building the unit tests and the examples.
Well, cmake should install the library, even its header-only. It should also provide cmake packaging and/or pkg-config to help with linking against the library and its dependencies. I do this in my libraries and could send you a pull request.
But I do wonder if it should be header-only. Is it that heavily templated that `.cpp` files don’t make sense?
> As far as linking goes, you
> should only need Boost.System (for error_code).
Oh, so it doesn’t use Boost.Asio either?
> Some of the unit tests
> use coroutines, to make sure that they work and also as a tool to
> assist reaching a high level of code coverage.
>
> You shouldn't need either the Jamfile or the CMakeLists.txt found in
> the repository in order to use Beast.
>
>> I would prefer not to have an HTTP library that depends on Boost.Context
>> due to portability issues(the author refuses to support mingw).
>
> I have no plans to add Boost.Context as a dependency, Beast uses the
> Universal Asynchronous Model which abstracts the completion token (see
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3747.pdf).
Ok awesome.
Uhh...err... okay, I have to admit - I've been a Windows user for
quite a long time. And Windows was born with a handicap - there's no
well defined place to put libraries and header files. So I'm behind
the curve on having CMake "install" the library (what would that even
mean for Windows?)
But, its an interesting coincidence, someone already raised this point:
https://github.com/vinniefalco/Beast/pull/98
If you want to submit a pull request for the install functionality, I
think that would be great.
> But I do wonder if it should be header-only.
> Is it that heavily templated that `.cpp` files don’t make sense?
Well, yes. The algorithms for serializing and parsing messages are
generic, accepting any object that meets the type requirements. The
WebSocket stream can wrap any object that meets the requirements. This
lets the same code work both for plain connections and SSL
connections. Or use your own socket class if you want.
On a related point, header-only libraries are more convenient. They
require less configuration and mostly "just work." The first thing
people ask about non-header only libraries in a formal review is "Why
isn't this header-only?"
>> As far as linking goes, you should only need Boost.System (for error_code).
>
> Oh, so it doesn’t use Boost.Asio either?
It "uses" Boost.Asio, but since Asio is also header-only, there is
nothing to link with. However, Boost.Asio also requires Boost.System
for error_code (unless you fiddle with some macros).
Thanks
> Boost.Context only builds for mingw if you have a MSVC assembler.
no - if you build boost.context on Windows you can use MSCV or MinGW. The
library selects the assembler tool provided by the compiler, e.g. MSVC ->
MASM, MinGW -> GNU as
please take a look at boost's regression tests - maybe your informations
are up-to-date
> However, the author has refused to accept those patches unfortunately.
the patches were incorrect
> When I build boost on ubuntu for mingw, I disable Boost.Context, which
> would mean disabling Boost.Beast as well.
>
should not be a problem as long as you provide the correct properties at b2
command line (architecture, address-model, binary-format, abi ...) for
cross compiling.
it is nearly impossible to provide assembler implementations for all
combinations of architecture + address-model + abi + binary format +
compiler/assembler (especially to have those systems to develop on)?
but you are welcome to provide a correct/valid support for your
combination/needs
> Also, Boost.Asio works fine as it doesn’t use Boost.Coroutine nor
> Boost.Context.
>
boost.asio's spawn/yield uses boost.coroutine and works well too
I did look at the assembly files. As there was only x86 `.S` files for elf and mach-o, I assumed they were missing, but the windows assembler are named like `*_gas.asm`. The different extension through me off. Sorry for the confusion.
>
>
>> However, the author has refused to accept those patches unfortunately.
>
>
> the patches were incorrect
>
>
>> When I build boost on ubuntu for mingw, I disable Boost.Context, which
>> would mean disabling Boost.Beast as well.
>>
>
> should not be a problem as long as you provide the correct properties at b2
> command line (architecture, address-model, binary-format, abi ...) for
> cross compiling.
Awesome!
>
> it is nearly impossible to provide assembler implementations for all
> combinations of architecture + address-model + abi + binary format +
> compiler/assembler (especially to have those systems to develop on)?
> but you are welcome to provide a correct/valid support for your
> combination/needs
Yes, I understand. I don’t expect it to support every combination out there, but mingw on linux is common.
I do wonder, if on C++11, it could have an option to fallback on threads when its on an unsupported platform. It would work, just not efficiently.
>
>
>> Also, Boost.Asio works fine as it doesn’t use Boost.Coroutine nor
>> Boost.Context.
>>
>
> boost.asio's spawn/yield uses boost.coroutine and works well too
I was unaware of this. I guess being header-only it depends on what features are used.
Thanks,
Paul
There are a lot of reasons for this:
1) Cmake can install configured headers in the library(such as a version or config header).
2) Cmake can install packaging information to make it easier to use and link the library. Just because it is header-only doesn’t mean it doesn’t need to link against other libraries.
> Boost does not use CMake and header-only libraries do not need to be "installed”.
Boost.Hana does use cmake and is header-only that is installed with cmake.
Paul
Whatever CMake can or cannot do, Boost should not require its use for
anything right now since their is no official support for it.
>> Boost does not use CMake and header-only libraries do not need to be "installed”.
>
> Boost.Hana does use cmake and is header-only that is installed with cmake.
Boost.Hana is part of Boost now and is "installed" when you install
Boost. In Github Boost Hana is installed when I get the Hana submodule.
If Boost Hana needs CMake in order to be installed or in order to work
that is news to me, and I am sure it would also be news to other Boost
developers.
I have no official stake in whatever debate may exist regarding Boost
Build and CMake but I think that, even if you favor CMake, you should
not be saying that CMake is necessary for Boost when it is not.
But it would be nice for it to support it now, as it will make it easier to use the library(especially before its accepted in boost).
>
>>> Boost does not use CMake and header-only libraries do not need to be "installed”.
>>
>> Boost.Hana does use cmake and is header-only that is installed with cmake.
>
> Boost.Hana is part of Boost now and is "installed" when you install Boost.
Its also installed with cmake.
> In Github Boost Hana is installed when I get the Hana submodule. If Boost Hana needs CMake in order to be installed or in order to work that is news to me, and I am sure it would also be news to other Boost developers.
>
> I have no official stake in whatever debate may exist regarding Boost Build and CMake but I think that, even if you favor CMake, you should not be saying that CMake is necessary for Boost when it is not.
I am not saying its required, but by having Boost.Beast support cmake makes it easier to use, and give real feedback for the review.
Paul