jamct / facerec

Face recognition for Raspberry Pi
3 stars 4 forks source link

compile error during build of npysort/radixsort #5

Open muenchhausen opened 5 years ago

muenchhausen commented 5 years ago

During the build running docker build -t facerec:latest . I get the following compile error:


    creating build/temp.linux-armv7l-3.6/build/src.linux-armv7l-3.6/numpy/core/src/npymath
    compile options: '-Ibuild/src.linux-armv7l-3.6/numpy/core/src/npymath -Inumpy/core/include -Ibuild/src.linux-armv7l-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/local/include/python3.6m -Ibuild/src.linux-armv7l-3.6/numpy/core/src/common -Ibuild/src.linux-armv7l-3.6/numpy/core/src/npymath -Ibuild/src.linux-armv7l-3.6/numpy/core/src/common -Ibuild/src.linux-armv7l-3.6/numpy/core/src/npymath -c'
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npymath/npy_math_complex.c
    gcc: numpy/core/src/npymath/npy_math.c
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npymath/ieee754.c
    gcc: numpy/core/src/npymath/halffloat.c
    In file included from numpy/core/src/npymath/npy_math.c:9:0:
    numpy/core/src/npymath/npy_math_internal.h.src: In function ‘npy_modfl’:
    numpy/core/src/npymath/npy_math_internal.h.src:490:21: warning: passing argument 2 of ‘modfl’ from incompatible pointer type
         return modf@c@(x, iptr);
                         ^
    In file included from /usr/local/include/python3.6m/pyport.h:194:0,
                     from /usr/local/include/python3.6m/Python.h:53,
                     from numpy/core/src/npymath/npy_math_private.h:21,
                     from numpy/core/src/npymath/npy_math_internal.h.src:56,
                     from numpy/core/src/npymath/npy_math.c:9:
    /usr/include/arm-linux-gnueabihf/bits/mathcalls.h:115:1: note: expected ‘long double *’ but argument is of type ‘npy_longdouble *’
     __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
     ^
    ar: adding 4 object files to build/temp.linux-armv7l-3.6/libnpymath.a
    building 'npysort' library
    compiling C sources
    C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC

    creating build/temp.linux-armv7l-3.6/build/src.linux-armv7l-3.6/numpy/core/src/npysort
    compile options: '-Ibuild/src.linux-armv7l-3.6/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-armv7l-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/local/include/python3.6m -Ibuild/src.linux-armv7l-3.6/numpy/core/src/common -Ibuild/src.linux-armv7l-3.6/numpy/core/src/npymath -Ibuild/src.linux-armv7l-3.6/numpy/core/src/common -Ibuild/src.linux-armv7l-3.6/numpy/core/src/npymath -c'
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npysort/quicksort.c
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npysort/mergesort.c
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npysort/timsort.c
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npysort/heapsort.c
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npysort/radixsort.c
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npysort/selection.c
    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 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src:112:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_bool’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_byte’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_byte’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_ubyte’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_ubyte’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_short’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_short’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_ushort’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_ushort’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_int’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_int’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_uint’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_uint’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_long’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_long’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_ulong’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_ulong’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_longlong’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_longlong’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘radixsort_ulonglong’:
    numpy/core/src/npysort/radixsort.c.src:112:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    numpy/core/src/npysort/radixsort.c.src: In function ‘aradixsort_ulonglong’:
    numpy/core/src/npysort/radixsort.c.src:202:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for (npy_intp i = 1; i < num; i++) {
         ^
    gcc: build/src.linux-armv7l-3.6/numpy/core/src/npysort/binsearch.c
    error: Command "gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Ibuild/src.linux-armv7l-3.6/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-armv7l-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/local/include/python3.6m -Ibuild/src.linux-armv7l-3.6/numpy/core/src/common -Ibuild/src.linux-armv7l-3.6/numpy/core/src/npymath -Ibuild/src.linux-armv7l-3.6/numpy/core/src/common -Ibuild/src.linux-armv7l-3.6/numpy/core/src/npymath -c build/src.linux-armv7l-3.6/numpy/core/src/npysort/radixsort.c -o build/temp.linux-armv7l-3.6/build/src.linux-armv7l-3.6/numpy/core/src/npysort/radixsort.o -MMD -MF build/temp.linux-armv7l-3.6/build/src.linux-armv7l-3.6/numpy/core/src/npysort/radixsort.o.d" failed with exit status 1

    ----------------------------------------
Command "/usr/local/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-l2iq_fvz/numpy/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-h86de0m9/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-l2iq_fvz/numpy/
You are using pip version 10.0.1, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c python3 -m ensurepip --upgrade && pip3 install --upgrade picamera[array] dlib' returned a non-zero code: 1
pi@raspberrypi:~/facerec $ 
kaback commented 5 years ago

I have had the same problem.

The compiler suggests to pass compiler flags ("note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code").

Doing so worked for me.

Change the following line

RUN python3 -m ensurepip --upgrade && pip3 install --upgrade picamera[array] dlib

in Dockerfile to

RUN python3 -m ensurepip --upgrade && CFLAGS=-std=c99 pip3 install --upgrade picamera[array] dlib