Issue 1:
I'm trying to install numpy from source but I'm seeing a lot of C99 errors.

Reproducing code example:

$ python -s setup.py --no-user-cfg build
$ python -s setup.py --no-user-cfg install --prefix=/Users/Adam/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/py-numpy-1.17.0-37xrxjmnbitsruc7alrutzpvdil2xhhy --single-version-externally-managed --root=/

Error message:

I see hundreds of errors like:

numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_bool':
numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (npy_intp i = 1; i < num; i++) {
^
numpy/core/src/npysort/radixsort.c.src:112:5: note: use option -std=c99 or -std=gnu99 to compile your code

Numpy/Python version information:

Linux CentOS 7

GCC 4.8.5

Python 3.7.4

Numpy 1.17.0

Issue 2:
Cannot build numpy v1.17.0 on CentOS 7.

Previous version works fine.

I'm seeing a lot of C99/C11 features in error message, and avx512f.

Not sure if the required --std option is set but I don't think gcc 4.8.5 (the system default compiler on CentOS 7) can handle all of that.

Reproducing code example:

Simply build the wheel on CentOS 7 with python3.

Error message:

Some error log attached.

The entire story is too long to be pasted here.

#6 356.1 compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -c'
#6 356.1 gcc: _configtest.c
#6 356.1 _configtest.c: In function 'main':
#6 356.1 _configtest.c:5:3: warning: implicit declaration of function '__builtin_mul_overflow' [-Wimplicit-function-declaration]
#6 356.1 __builtin_mul_overflow(5, 5, (int*)5);
#6 356.1 ^
#6 356.1 gcc -pthread _configtest.o -o _configtest
#6 356.1 _configtest.o: In function `main':
#6 356.1 /tmp/pip-req-build-poiltggx/_configtest.c:5: undefined reference to `__builtin_mul_overflow'
#6 356.1 collect2: error: ld returned 1 exit status
#6 356.1 failure.
#6 356.1 removing: _configtest.c _configtest.o _configtest.o.d
#6 356.1 C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC
#6 356.1
#6 356.1 compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -c'
#6 356.1 gcc: _configtest.c
#6 356.1 _configtest.c: In function 'main':
#6 356.1 _configtest.c:7:16: warning: unused variable 'r' [-Wunused-variable]
#6 356.1 volatile int r = __builtin_cpu_supports("sse");
#6 356.1 ^
#6 356.1 gcc -pthread _configtest.o -o _configtest
#6 356.1 success!
#6 356.1 removing: _configtest.c _configtest.o _configtest.o.d _configtest
#6 356.1 C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC
#6 356.1
#6 356.1 compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -c'
#6 356.1 gcc: _configtest.c
#6 356.1 _configtest.c: In function 'main':
#6 356.1 _configtest.c:7:3: error: Parameter to builtin not valid: avx512f
#6 356.1 volatile int r = __builtin_cpu_supports("avx512f");
#6 356.1 ^
#6 356.1 _configtest.c:7:16: warning: unused variable 'r' [-Wunused-variable]
#6 356.1 volatile int r = __builtin_cpu_supports("avx512f");
#6 356.1 ^
#6 356.1 failure.
#6 356.1 removing: _configtest.c _configtest.o
#6 356.1 C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC
#6 356.1
#6 356.1 compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -c'
#6 356.1 gcc: _configtest.c
#6 356.1 gcc -pthread _configtest.o -o _configtest
#6 356.1 success!
#6 356.1 removing: _configtest.c _configtest.o _configtest.o.d _configtest
#6 356.1 C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC
#6 356.1
#6 356.1 compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -c'
#6 356.1 gcc: _configtest.c
#6 356.1 gcc -pthread _configtest.o -o _configtest
#6 356.1 success!
#6 356.1 removing: _configtest.c _configtest.o _configtest.o.d _configtest

#6 358.3 C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC
#6 358.3
#6 358.3 compile options: '-Ibuild/src.linux-x86_64-3.6/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-x86_64-3.6/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -Ibuild/src.linux-x86_64-3.6/numpy/core/src/common -Ibuild/src.linux-x86_64-3.6/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.6/numpy/core/src/common -Ibuild/src.linux-x86_64-3.6/numpy/core/src/npymath -c'
#6 358.3 gcc: build/src.linux-x86_64-3.6/numpy/core/src/npysort/radixsort.c
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_bool':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: note: use option -std=c99 or -std=gnu99 to compile your code
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_bool':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_byte':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_byte':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_ubyte':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_ubyte':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_short':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_short':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_ushort':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_ushort':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_int':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_int':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_uint':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_uint':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_long':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_long':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_ulong':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_ulong':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_longlong':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_longlong':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'radixsort_ulonglong':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:112:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 numpy/core/src/npysort/radixsort.c.src: In function 'aradixsort_ulonglong':
#6 358.3 numpy/core/src/npysort/radixsort.c.src:202:5: error: 'for' loop initial declarations are only allowed in C99 mode
#6 358.3 for (npy_intp i = 1; i < num; i++) {
#6 358.3 ^
#6 358.3 error: Command "gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Ibuild/src.linux-x86_64-3.6/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-x86_64-3.6/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -Ibuild/src.linux-x86_64-3.6/numpy/core/src/common -Ibuild/src.linux-x86_64-3.6/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.6/numpy/core/src/common -Ibuild/src.linux-x86_64-3.6/numpy/core/src/npymath -c build/src.linux-x86_64-3.6/numpy/core/src/npysort/radixsort.c -o build/temp.linux-x86_64-3.6/build/src.linux-x86_64-3.6/numpy/core/src/npysort/radixsort.o -MMD -MF build/temp.linux-x86_64-3.6/build/src.linux-x86_64-3.6/numpy/core/src/npysort/radixsort.o.d" failed with exit status 1
#6 358.3 ----------------------------------------
#6 358.4 ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-poiltggx/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-poiltggx/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-50nzprh1/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

Numpy/Python version information:

CentOS 7

Default python 3 (3.6)

Default gcc (4.8)