BUILD_opencv_gapi:BOOL=OFF
should be bypassing any issues stemming from the module so I hope building with that option will succeed.
if it doesn’t, try running with make -j1
(or maybe some other appropriate value). some people on the internet say the error can happen because the system is out of resources (too many parallel builds)