在mac os x Mavericks上安装blist

3 投票
2 回答
519 浏览
提问于 2025-04-17 22:48

当我在我的Mac上(OS X Mavericks 10.9.2)安装blist的时候,遇到了一个错误。

creating build/temp.macosx-10.9-intel-2.7

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DBLIST_FLOAT_RADIX_SORT=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _blist.c -o build/temp.macosx-10.9-intel-2.7/_blist.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

Clang版本:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

2 个回答

1

我找到了解决这个问题的方法。

首先,安装 apple-gcc42(如果你用 Homebrew,可以使用下面的命令):

$brew install apple-gcc42

然后,修改 /usr/bin/cc 的符号链接。

$ls -al /usr/bin/cc
lrwxr-xr-x  1 root  wheel  5 Feb 25 11:11 cc -> clang 

使用下面的命令:

$cd /usr/bin
$sudo ln -sf /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 cc

$ls -al /usr/bin/cc
lrwxr-xr-x  1 root  wheel  54 Mar 18 12:50 cc -> /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2

这里的 "/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2" 是 Homebrew 安装 apple-gcc42 编译器的路径。

接着,安装 blist。

如果你找到更好的解决办法,请分享出来。

1

根据github上的一个问题和这个SO上的回答,以下的方法对我有效。

sudo su
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
pip install blist

撰写回答