Jon*_*Jon 5 python compiler-errors avx avx2
我正在尝试在CentOS 6.5服务器上通过安装烦恼pip install annoy,但出现以下错误。任何的想法?我VBROADCASTSS在这里找到了,但仍然不知道如何解决这些错误。
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/xxx/.pyenv/versions/2.7.10/include/python2.7 -c src/annoymodule.cc -o build/temp.linux-x86_64-2.7/src/annoymodule.o -O3 -march=native -ffast-math
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
In file included from /home/xxx/.pyenv/versions/2.7.10/include/python2.7/Python.h:8:0,
from src/annoymodule.cc:16:
/home/xxx/.pyenv/versions/2.7.10/include/python2.7/pyconfig.h:1188:0: warning: "_POSIX_C_SOURCE" redefined
#define _POSIX_C_SOURCE 200112L
^
In file included from /usr/include/stdio.h:28:0,
from src/annoylib.h:18,
from src/annoymodule.cc:15:
/usr/include/features.h:162:0: note: this is the location of the previous definition
# define _POSIX_C_SOURCE 200809L
^
In file included from /home/xxx/.pyenv/versions/2.7.10/include/python2.7/Python.h:8:0,
from src/annoymodule.cc:16:
/home/xxx/.pyenv/versions/2.7.10/include/python2.7/pyconfig.h:1210:0: warning: "_XOPEN_SOURCE" redefined
#define _XOPEN_SOURCE 600
^
In file included from /usr/include/stdio.h:28:0,
from src/annoylib.h:18,
from src/annoymodule.cc:15:
/usr/include/features.h:164:0: note: this is the location of the previous definition
# define _XOPEN_SOURCE 700
^
/tmp/ccfNu0mQ.s: Assembler messages:
/tmp/ccfNu0mQ.s:21160: Error: suffix or operands invalid for `vbroadcastss'
/tmp/ccfNu0mQ.s:21163: Error: suffix or operands invalid for `vbroadcastss'
/tmp/ccfNu0mQ.s:21532: Error: suffix or operands invalid for `vbroadcastss'
/tmp/ccfNu0mQ.s:24347: Error: suffix or operands invalid for `vbroadcastss'
/tmp/ccfNu0mQ.s:24350: Error: suffix or operands invalid for `vbroadcastss'
/tmp/ccfNu0mQ.s:24718: Error: suffix or operands invalid for `vbroadcastss'
error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
我gcc -march=native -Q --help=target用来比较几台Linux机器上的gcc设置。我发现主要区别在于-march故障机器上的生产线是haswell,而其他类似core...。这是其他服务器的相应输出:
CentOS release 6.5 (Final) -- -march=corei7-avx
CentOS Linux 7 (Core) -- -march=core-avx-i
Debian GNU/Linux 7 (wheezy) -- -march=core-avx2
我猜这些错误来自使用的gcc不同的指令集。在烦扰的setup.py,在-march=native符合extra_compile_args=['-O3', '-march=native', '-ffast-math']手段GCC将尝试检测处理器,并自动设置相应的标志吧。所以我将此标志更改为-march=corei7-avxin setup.py,错误消失了。
请参阅-march在这里的细节,如果你有兴趣。
与服务器管理员确认后,此错误是由于CentOS加载程序软件比服务器中的新Haswell CPU老。安装最新版本的binutils软件包也可以解决该问题。