`terminate called after throwing an instance of 'std::system_error'`

I’m not sure, what is causing this error, but I would recommend to try out native amp as described here without the need to build apex.