clang:错误:未知参数:'-mno-fused-madd'[-Wunused-command-line-argument-hard-error-in-future]

ago*_*gon 12 python x11 pip scrapy xcode5.1

尝试在Mavericks OS中安装Scrapy时出现以下错误.

我有命令行工具和X11安装我真的不知道发生了什么,我没有发现同样的错误浏览网页.我认为这可能与Xcode 5.1中的一些变化有关

谢谢你的回答!

这是命令输出的一部分:

$ pip install scrapy


.
.
.
.

Downloading/unpacking cryptography>=0.2.1 (from pyOpenSSL->scrapy)
  Downloading cryptography-0.3.tar.gz (208kB): 208kB downloaded
  Running setup.py egg_info for package cryptography
    OS/X: confusion between 'cc' versus 'gcc' (see issue 123)
    will not use '__thread' in the C code
    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
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/Users/agonzamart/.virtualenvs/Parser/build/cryptography/setup.py", line 156, in <module>
        "test": PyTest,
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 265, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 289, in fetch_build_eggs
        parse_requirements(requires), installer=self.fetch_build_egg
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 618, in resolve
        dist = best[req.key] = env.best_match(req, self, installer)
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 862, in best_match
        return self.obtain(req, installer) # try and download/install
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 874, in obtain
        return installer(requirement)
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 339, in fetch_build_egg
        return cmd.easy_install(req)
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 653, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 849, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1130, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1118, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'cc' failed with exit status 1
    Complete output from command python setup.py egg_info:
    OS/X: confusion between 'cc' versus 'gcc' (see issue 123)

will not use '__thread' in the C code

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

Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/Users/agonzamart/.virtualenvs/Parser/build/cryptography/setup.py", line 156, in <module>

    "test": PyTest,

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 265, in __init__

    self.fetch_build_eggs(attrs.pop('setup_requires'))

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 289, in fetch_build_eggs

    parse_requirements(requires), installer=self.fetch_build_egg

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 618, in resolve

    dist = best[req.key] = env.best_match(req, self, installer)

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 862, in best_match

    return self.obtain(req, installer) # try and download/install

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/pkg_resources.py", line 874, in obtain

    return installer(requirement)

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/dist.py", line 339, in fetch_build_egg

    return cmd.easy_install(req)

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 623, in easy_install

    return self.install_item(spec, dist.location, tmpdir, deps)

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 653, in install_item

    dists = self.install_eggs(spec, download, tmpdir)

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 849, in install_eggs

    return self.build_and_install(setup_script, setup_base)

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1130, in build_and_install

    self.run_setup(setup_script, setup_base, args)

  File "/Users/agonzamart/.virtualenvs/Parser/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1118, in run_setup

    raise DistutilsError("Setup script exited with %s" % (v.args[0],))

distutils.errors.DistutilsError: Setup script exited with error: command 'cc' failed with exit status 1

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/agonzamart/.virtualenvs/Parser/build/cryptography
Run Code Online (Sandbox Code Playgroud)

Ned*_*ily 23

这是由于clang默认值的变化Xcode 5.1而且Apple没有注意到它会破坏使用系统Python的扩展模块构建.一种解决方法是首先定义以下环境变量:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Run Code Online (Sandbox Code Playgroud)

更新[2014-05-16]:正如预期的那样,Apple已经使用更新的系统Pythons(2.7,2.6和2.5)OS X 10.9.3解决了这个问题,因此在使用最新的Mavericks时不再需要解决方法Xcode 5.1+.但是,截至目前,OS X 10.8.x如果您在Xcode 5.1+那里使用(Mountain Lion,目前为10.8.5),仍需要解决方法.

  • 你在用sudo吗?如果是这样,环境变量设置可能无法复制到sudo环境中.尝试`sudo bash`,然后输入`export`语句,然后输入`pip`或`python`命令. (6认同)

mir*_*ngu 8

最新版本的clang 提升到了曾经是警告的错误级别.要切换回来,您可以在运行install命令之前内联删除此行为:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install <your package>
Run Code Online (Sandbox Code Playgroud)

这应该可行,但万一出现问题,这里有更多信息:clang错误:未知参数:' - mno-fused-madd'(python包安装失败)