Joris Kluivers

I like to build software.

LLVM Unrecognized Command Line Options

The LLVM compiler in Xcode 5.1 now treats unrecognized compiler options as errors by default. Building Python or Ruby modules using unrecognized flags will now cause the build to fail.

I ran into this when trying to build lxml for Python recently. This failed with the following error message:

 clang: error: unknown argument: '-mno-fused-madd'

Google or stackoverflow provided no answer to this problem.

As long as the build configurations are not updated an up-to-date OS X system will currently fail to build modules like lxml for Python.

Luckily a (temporary) solution is available in the the Xcode release notes:

The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors.
To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning.

Use the following to successfully build lxml on Mavericks with LLVM/Xcode 5.1:

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install lxml