安装Distance python库时Clang链接器问题

时间:2015-09-23 14:27:07

标签: python c macos gcc

我正在尝试在我的mac(OS X Yosemite)上为python安装Distance

下载软件包并解压后,我运行(如页面所述):

python setup.py install --with-c

从此我收到以下错误消息:

running build_ext
building 'distance.cdistance' extension
gcc -fno-strict-aliasing -I/Users/me/anaconda/envs/name/include -   arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/me/anaconda/envs/name/include/python2.7 -c cdistance/distance.c -o build/temp.macosx-10.5-x86_64-2.7/cdistance/distance.o
gcc -bundle -undefined dynamic_lookup -L/Users/me/anaconda/envs/name/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/cdistance/distance.o -L/Users/me/anaconda/envs/name/lib -o build/lib.macosx-10.5-x86_64-2.7/distance/cdistance.so
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1

根据我对this onethis previously asked question等几个帖子的理解,它看起来像clang,通过命令gcc调用,找不到libgcc库。

我跑了find /usr/ -name libgcc*,这就是我得到的:

/usr//lib/libgcc_s.1.dylib
/usr//lib/libgcc_s.10.4.tbd
/usr//lib/libgcc_s.10.5.tbd
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/i386/libgcc.a
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/i386/libgcc_eh.a
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/libgcc.a
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/libgcc_eh.a
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_ext.10.4.dylib
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_ext.10.5.dylib
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_s.1.dylib
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_s_ppc64.1.dylib
/usr//local/Cellar/gcc/5.2.0/lib/gcc/5/libgcc_s_x86_64.1.dylib
/usr//local/gfortran/lib/gcc/x86_64-apple-darwin14/5.1.0/i386/libgcc.a
/usr//local/gfortran/lib/gcc/x86_64-apple-darwin14/5.1.0/i386/libgcc_eh.a
/usr//local/gfortran/lib/gcc/x86_64-apple-darwin14/5.1.0/libgcc.a
/usr//local/gfortran/lib/gcc/x86_64-apple-darwin14/5.1.0/libgcc_eh.a
/usr//local/gfortran/lib/libgcc_ext.10.4.dylib
/usr//local/gfortran/lib/libgcc_ext.10.5.dylib
/usr//local/gfortran/lib/libgcc_s.1.dylib
/usr//local/gfortran/lib/libgcc_s_ppc64.1.dylib
/usr//local/gfortran/lib/libgcc_s_x86_64.1.dylib

现在我被困了,因为我不知道下一步该做什么。基本上问题是:如何让clang知道库的位置?

1 个答案:

答案 0 :(得分:0)

由于this link表明这是Xcode6最近出现的问题,我解决了这个问题。

您只需将Xcode升级到Xcode7并将其设置为默认工具包链。容易。