Saudi Arabia has agreed to construct a solar power plant and sell electricity to Iraq, which is grappling with protests over power shortages.