Fix compilation on Mac.

Fixes issue 3167.