23

So, I've found some other clang error's on here that appear to be somewhat similar, however, the fixes aren't applicable to my situation.

I'm using OSX Mavericks and we're trying to get Ansible installed. I got pip to install correctly, but when I try to install Ansible, I get this clang error. We thought, at first, that it might be a version issue, so I re-installed gcc46 after having this same error with gcc49, but I'm still getting the error.

Does anyone know how to fix this?

My complete error report from the pip.log log file is as follows:

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -Wall -Wstrict-prototypes -Wshorten-64-to-32 -fwrapv -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/MD2.c -o build/temp.macosx-10.9-intel-2.7/src/MD2.o

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'cc' failed with exit status 1

----------------------------------------
Cleaning up...
  Removing temporary dir /private/tmp/pip_build_root...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_7evji-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/pycrypto
Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_7evji-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/pycrypto

Thanks to anyone who can help me with this. We've spent the past several hours trying to get this to install, and it's starting to get fairly frustrating.

CreationTribe
  • 562
  • 1
  • 5
  • 17
  • I installed ansible on OSX Mavericks using "git clone", as described in http://docs.ansible.com/intro_installation.html#running-from-source and it works like a charm. Can you tell how are you installing it? – Alexander Jardim Mar 13 '14 at 21:31
  • I've actually tried both methods. I've tried cloning the Ansible repo, and running it from there, as well as installing it with pip. The problem is that Ansible requires paramiko, PyYAML, jinja2, and httplib2. When attempting the installation of these packages - again with pip - I get the exact same error. – CreationTribe Mar 13 '14 at 21:59
  • Its not ansible. Its Mavericks Python. Here is an answer: http://stackoverflow.com/a/20295014/16998 – jrwren Mar 18 '14 at 15:29

3 Answers3

67

I ran into the same problem recently while trying to install a different package.

Setting the following environment variables prior to installing with pip resolved the issue for me:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

If you're installing via sudo, don't forget to use "sudo -E" so that your environment variables propagate through sudo.

If that doesn't work for you, try the following command instead:

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

Alternatively, as yet another potential solution, you can attempt to recompile a fresh version of python using Homebrew.

See this question for more information.

Hope this helps!

Community
  • 1
  • 1
tino
  • 4,780
  • 5
  • 24
  • 30
  • unfortunately none of these have helped.However, the link you've provided has nudged me in the right direction. I think what I'll end up having to do is remove pip and python altogether, then reinstall python with brew. If that works, I'll let you know. Since much of that is in the link - if you want - you can alter your answer to fit what I ended up doing and I'll check you off as the correct answer. Thanks for the help :) – CreationTribe Mar 17 '14 at 22:22
  • @CreationTribe, no problem. still getting the same error huh? hopefully a fresh python install will do it for you. i made a small edit but no worries -- if you resolve it, it might make more sense for you to write up what worked for you in a separate answer and mark that one as correct. good luck! – tino Mar 18 '14 at 15:06
  • This worked for me to run ``pip install reportlab`` after exporting the first two values listed. I have python installed via Homebrew and a Virtualenv with Pip. Thanks! – shawnr Mar 18 '14 at 17:45
  • 5
    if it still doesnt work use sudo -E pip install pycrypto after setting the variables, The -E part is the magic! – Fortes Mar 21 '14 at 00:34
  • This post helped me solve a ruby bundler issue with RedCloth. I ended up using `export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"; bundle install` – Steve Jansen Apr 13 '14 at 20:51
  • The archflags.. + sudo -E option worked for me on OSX 10.9.2 - thanks – SonarJetLens Apr 14 '14 at 09:52
  • I had similar issue install a gem, I ran `sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install puma` and it worked. Thanks! – Travis Reeder Apr 17 '14 at 18:14
  • Similar issue installing Cython with pip. This also fixed it and I used: `sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install cython` – Bach May 13 '14 at 22:01
6

For the beginners, who read and tried the answer above but still failed (me):

sudo su - export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments pip install ansible exit

You need to run those export commands as the root user. The previous answer clearly states this, but what it actually meant didn't translate to me as a terminal novice. What sudo su - does is basically switch to the root user. Then any commands you type are executed as root, and this thing works.

This finally let me get Ansible running on OSX 10.9.2 after a lot of head-banging.

Solution reference: https://github.com/ansible/ansible/issues/7146#issuecomment-41239561

Community
  • 1
  • 1
Brendan Falkowski
  • 733
  • 1
  • 5
  • 17
3
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future cc .....

or

export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
julienc
  • 19,087
  • 17
  • 82
  • 82
fbs
  • 31
  • 1