Revert "Remove build optimization flags to fix compile."

This reverts commit 5f60e7131adc8c9a602a4975e6c35a29ccb6ad32.