On older Apple compilers "-O4" is known to cause build errors. On recent clang, it's the same as "-O3" and you have to pass "-O3 -flto" to get the old behavior.