Ansible Installation -clang: error: unknown argume

2019-01-13 01:48发布

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.

3条回答
Anthone
2楼-- · 2019-01-13 02:14

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!

查看更多
Lonely孤独者°
3楼-- · 2019-01-13 02:21
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"
查看更多
狗以群分
4楼-- · 2019-01-13 02:35

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

查看更多
登录 后发表回答