I'm trying to install annoy via pip install annoy
on a CentOS 6.5 server, but got the following errors. Any idea? I found VBROADCASTSS
in here, but still have no idea how to fix these error.
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
I use gcc -march=native -Q --help=target
to compare the gcc settings on several Linux machines.
I find out the main difference is that the -march
line on the failed machine is haswell
, and others are
something like core...
. Here's is the corresponding outputs from other servers:
CentOS release 6.5 (Final)
- -march=corei7-avx
CentOS Linux 7 (Core)
- -march=core-avx-i
Debian GNU/Linux 7 (wheezy)
- -march=core-avx2
I guess the errors come from the different instruction sets gcc used.
In annoy's setup.py
, the -march=native
in line extra_compile_args=['-O3', '-march=native', '-ffast-math']
means gcc will attempt to detect the processor and automatically set appropriate flags for it.
So I change this flag to -march=corei7-avx
in setup.py
and the errors gone.
See -march
in here for details if you are interested.
After confirming with the server admins, this error is due to the CentOS loader software being older than the new Haswell CPUs in the server. Installing a recent version of binutils
package can also solve the problem.
Your version of binutils is too old to support AVX/AVX2 instructions, which have been detected as available on your processor. You need binutils 2.22 or newer for AVX support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With