I know installing OpenCV is tiresome. I can try to help you, can you tell me what is your swap size in
sudo nano /etc/dphys-swapfile ? If it is 100 please make it 1024. I hope that helps.
And then try to make OpenCV and use the command make -j4.