Heim  >  Artikel  >  Datenbank  >  mac xcode5.1安装Mysql-python编译异常解决

mac xcode5.1安装Mysql-python编译异常解决

WBOY
WBOYOriginal
2016-06-07 16:24:501207Durchsuche

mac xcode5.1安装Mysql-python编译错误解决 前几天才入的macbook air,在 app store 安装的xcode和command_line_tools都是最新版本,结果我被坑了,编译工具太新了,不兼容,出现错误。 clang : error : unknown argument : '-mno-fused-madd' [- Wunused - c

mac xcode5.1安装Mysql-python编译错误解决

前几天才入的macbook air,在 app store 安装的xcode和command_line_tools都是最新版本,结果我被坑了,编译工具太新了,不兼容,出现错误。

<code><span class="pln">clang</span><span class="pun">:</span><span class="pln"> error</span><span class="pun">:</span><span class="pln"> unknown argument</span><span class="pun">:</span><span class="pln"> </span><span class="str">'-mno-fused-madd'</span><span class="pln"> </span><span class="pun">[-</span><span class="typ">Wunused</span><span class="pun">-</span><span class="pln">command</span><span class="pun">-</span><span class="pln">line</span><span class="pun">-</span><span class="pln">argument</span><span class="pun">-</span><span class="pln">hard</span><span class="pun">-</span><span class="pln">error</span><span class="pun">-</span><span class="kwd">in</span><span class="pun">-</span><span class="pln">future</span><span class="pun">]</span></code>


我在mysql-python.sourceforge.net下载MySQL-python-1.2.4b4.tar.gz 

shell cmd :

   tar -cjf MySQL-python-1.2.4b4.tar.gz 

   cd MySQL-python-1.2.4b4 

   python setup.py build

然后出现下面都错误代码

<code><span class="pln">build</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">.</span><span class="pln">macosx</span><span class="pun">-</span><span class="lit">10.9</span><span class="pun">-</span><span class="pln">intel</span><span class="pun">-</span><span class="lit">2.7</span><span class="pun">/</span><span class="typ">MySQLdb</span><span class="pln"> running build_ext building </span><span class="str">'_mysql'</span><span class="pln"> extension
cc </span><span class="pun">-</span><span class="pln">fno</span><span class="pun">-</span><span class="pln">strict</span><span class="pun">-</span><span class="pln">aliasing </span><span class="pun">-</span><span class="pln">fno</span><span class="pun">-</span><span class="pln">common </span><span class="pun">-</span><span class="kwd">dynamic</span><span class="pln"> </span><span class="pun">-</span><span class="pln">g </span><span class="pun">-</span><span class="typ">Os</span><span class="pln"> </span><span class="pun">-</span><span class="pln">pipe </span><span class="pun">-</span><span class="pln">fno</span><span class="pun">-</span><span class="pln">common </span><span class="pun">-</span><span class="pln">fno</span><span class="pun">-</span><span class="pln">strict</span><span class="pun">-</span><span class="pln">aliasing </span><span class="pun">-</span><span class="pln">fwrapv </span><span class="pun">-</span><span class="pln">mno</span><span class="pun">-</span><span class="pln">fused</span><span class="pun">-</span><span class="pln">madd </span><span class="pun">-</span><span class="pln">DENABLE_DTRACE </span><span class="pun">-</span><span class="pln">DMACOSX </span><span class="pun">-</span><span class="pln">DNDEBUG </span><span class="pun">-</span><span class="typ">Wall</span><span class="pln"> </span><span class="pun">-</span><span class="typ">Wstrict</span><span class="pun">-</span><span class="pln">prototypes </span><span class="pun">-</span><span class="typ">Wshorten</span><span class="pun">-</span><span class="lit">64</span><span class="pun">-</span><span class="pln">to</span><span class="pun">-</span><span class="lit">32</span><span class="pln"> </span><span class="pun">-</span><span class="pln">DNDEBUG </span><span class="pun">-</span><span class="pln">g </span><span class="pun">-</span><span class="pln">fwrapv </span><span class="pun">-</span><span class="typ">Os</span><span class="pln"> </span><span class="pun">-</span><span class="typ">Wall</span><span class="pln"> </span><span class="pun">-</span><span class="typ">Wstrict</span><span class="pun">-</span><span class="pln">prototypes </span><span class="pun">-</span><span class="pln">DENABLE_DTRACE </span><span class="pun">-</span><span class="pln">pipe </span><span class="pun">-</span><span class="typ">Dversion_info</span><span class="pun">=(</span><span class="lit">1</span><span class="pun">,</span><span class="lit">2</span><span class="pun">,</span><span class="lit">4</span><span class="pun">,</span><span class="str">'beta'</span><span class="pun">,</span><span class="lit">4</span><span class="pun">)</span><span class="pln"> </span><span class="pun">-</span><span class="pln">D__version__</span><span class="pun">=</span><span class="lit">1.2</span><span class="pun">.</span><span class="lit">4b4</span><span class="pln"> </span><span class="pun">-</span><span class="pln">I</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">include </span><span class="pun">-</span><span class="pln">I</span><span class="pun">/</span><span class="typ">System</span><span class="pun">/</span><span class="typ">Library</span><span class="pun">/</span><span class="typ">Frameworks</span><span class="pun">/</span><span class="typ">Python</span><span class="pun">.</span><span class="pln">framework</span><span class="pun">/</span><span class="typ">Versions</span><span class="pun">/</span><span class="lit">2.7</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">python2</span><span class="pun">.</span><span class="lit">7</span><span class="pln"> </span><span class="pun">-</span><span class="pln">c _mysql</span><span class="pun">.</span><span class="pln">c </span><span class="pun">-</span><span class="pln">o build</span><span class="pun">/</span><span class="pln">temp</span><span class="pun">.</span><span class="pln">macosx</span><span class="pun">-</span><span class="lit">10.9</span><span class="pun">-</span><span class="pln">intel</span><span class="pun">-</span><span class="lit">2.7</span><span class="pun">/</span><span class="pln">_mysql</span><span class="pun">.</span><span class="pln">o </span><span class="pun">-</span><span class="typ">Os</span><span class="pln"> </span><span class="pun">-</span><span class="pln">g </span><span class="pun">-</span><span class="pln">fno</span><span class="pun">-</span><span class="pln">strict</span><span class="pun">-</span><span class="pln">aliasing </span><span class="pun">-</span><span class="pln">arch x86_64</span></code>
<code><span class="pln"></span></code><pre class="default prettyprint prettyprinted"><code><span class="pln">clang</span><span class="pun">:</span><span class="pln"> error</span><span class="pun">:</span><span class="pln"> unknown argument</span><span class="pun">:</span><span class="pln"> </span><span class="str">'-mno-fused-madd'</span><span class="pln"> </span><span class="pun">[-</span><span class="typ">Wunused</span><span class="pun">-</span><span class="pln">command</span><span class="pun">-</span><span class="pln">line</span><span class="pun">-</span><span class="pln">argument</span><span class="pun">-</span><span class="pln">hard</span><span class="pun">-</span><span class="pln">error</span><span class="pun">-</span><span class="kwd">in</span><span class="pun">-</span><span class="pln">future</span><span class="pun">]</span><span class="pln">

clang</span><span class="pun">:</span><span class="pln"> note</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">this</span><span class="pln"> will be a hard error </span><span class="pun">(</span><span class="pln">cannot be downgraded to a warning</span><span class="pun">)</span><span class="pln"> </span><span class="kwd">in</span><span class="pln"> the future

error</span><span class="pun">:</span><span class="pln"> command </span><span class="str">'cc'</span><span class="pln"> failed </span><span class="kwd">with</span><span class="pln"> </span><span class="kwd">exit</span><span class="pln"> status </span><span class="lit">1</span></code>

说一下问题分析过程,我开始分析  setup.py里面的代码,想找出编译选项-mno-fused-madd,然后将它删除,可是找了半天没找到,

发现python调用的是setuptools模块,我就去找这个模块的代码,最后发现是一个egg包,没办法去看它的源码。


最后没办法了,我想了一下应该是我的编译工具太新了的原因。

最后成功解决办法

我在网上找到xcode5.0.2和老一点版本的command_line_tools的dmg包

卸载xcode5.1然后安装这两个包,最后问题解决了!!!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn