boostorg/process

Unable to compile code using boost/process.hpp

Closed this issue · 11 comments

The following code fails to build in Visual Studio 2019 (16.4.1) using boost 1.72, debug x64 build.

#include "boost/process.hpp"

void out(const char* d);
int main()
{
char data[100000];
memset(data, 0, sizeof data);

boost::asio::io_context ios;

boost::process::child c("dir", boost::process::std_out > boost::asio::buffer(data), boost::process::std_err > boost::process::null, ios);

ios.run();
int result = c.exit_code();
out(data);

}
#include
void out(const char* d)
{
std::cout << d;
}

Errors:

C:\boost\boost_1_72_0\boost\asio\impl\read.hpp(460,39): error C2039: 'executor_type': is not a member of 'boost::process::detail::windows::async_pipe'
C:\boost\boost_1_72_0\boost\asio\impl\read.hpp(460,1): error C3646: 'executor_type': unknown override specifier
C:\boost\boost_1_72_0\boost\asio\impl\read.hpp(460,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Adding
#include "boost/asio.hpp"
didn't help.

I have a similar problem on Linux (with multiple GCC and Clang versions). The following is output from GCC on the program from klemens-morgenstern/boost-process#124

main.cpp:22:4:   required from here
/opt/boost_1_72/include/boost/asio/impl/write.hpp:425:54: error: no type named ‘executor_type’ in ‘class boost::process::detail::posix::async_pipe’
     typedef typename AsyncWriteStream::executor_type executor_type;
                                                      ^~~~~~~~~~~~~

Applying the changes in 6a4d2ff seemingly fixes the problem (on Linux). The problem seems to be new in 1.72.

I hit this problem too. Reverting to 1.71 fixed.

boost.asio changed to require that, I will fix it. But it sadly will only make 1.73.

How is there not an asio/process integration test that failed on the 1.72 release candidate? The boost folks do execute the test suite as part of the release process I assume? In addition to fixing it, would it make sense to also add a test that would have failed if not for the fix?

There are and they failed, but I failed to notice and fix it early enough. Boost has a pretty tight release schedule, so it's gonna be fixed in the next one.

This seems to be fixed in 1.73.0, released yesterday. Can it be closed?

I can't personally verify fixed until the release propogates to the boost conan recipe: https://github.com/conan-io/conan-center-index/blob/master/recipes/boost/all/conandata.yml Will be able to do so in a few days.

conan recipe for 1.73 is up, I'll try it out within 24 hrs

ok tried it. it works. vote confirmed fix and close

Awesome, thanks!