lducas / FHEW

Other
218 stars 46 forks source link

Fresh clone fails to build #24

Open jonathanherzog opened 1 year ago

jonathanherzog commented 1 year ago

When I check out a fresh clone of the repo, branch master, the build fails:

88665a20d7ba:FHEW jcherzog$ make
g++ -ansi -Wall -O3 -c distrib.cpp
In file included from distrib.cpp:2:
In file included from ./distrib.h:4:
./params.h:24:25: warning: implicit conversion from 'long' to 'const ZmodQ' (aka 'const int') changes value from 3758096385 to -536870911 [-Wconstant-conversion]
const ZmodQ v_inverse = 3758096385; // 1/v mod Q
            ~~~~~~~~~   ^~~~~~~~~~
./params.h:26:31: warning: signed shift result (0x10000000800) requires 42 bits to represent, but 'ZmodQ' (aka 'int') only has 32 bits [-Wshift-overflow]
const ZmodQ vgprime[3] = {v, v<<11, v<<22};
                             ~^ ~~
./params.h:26:38: warning: signed shift result (0x8000000400000) requires 53 bits to represent, but 'ZmodQ' (aka 'int') only has 32 bits [-Wshift-overflow]
const ZmodQ vgprime[3] = {v, v<<11, v<<22};
                                    ~^ ~~
3 warnings generated.
g++ -ansi -Wall -O3 -c FFT.cpp
In file included from FFT.cpp:3:
In file included from ./FFT.h:4:
./params.h:24:25: warning: implicit conversion from 'long' to 'const ZmodQ' (aka 'const int') changes value from 3758096385 to -536870911 [-Wconstant-conversion]
const ZmodQ v_inverse = 3758096385; // 1/v mod Q
            ~~~~~~~~~   ^~~~~~~~~~
./params.h:26:31: warning: signed shift result (0x10000000800) requires 42 bits to represent, but 'ZmodQ' (aka 'int') only has 32 bits [-Wshift-overflow]
const ZmodQ vgprime[3] = {v, v<<11, v<<22};
                             ~^ ~~
./params.h:26:38: warning: signed shift result (0x8000000400000) requires 53 bits to represent, but 'ZmodQ' (aka 'int') only has 32 bits [-Wshift-overflow]
const ZmodQ vgprime[3] = {v, v<<11, v<<22};
                                    ~^ ~~
FFT.cpp:24:22: error: expected ')'
    res[k] = (double complex) out[2*k+1];                               
                     ^
FFT.cpp:24:14: note: to match this '('
    res[k] = (double complex) out[2*k+1];                               
             ^
FFT.cpp:24:14: error: C-style cast from 'double *' to 'double' is not allowed
    res[k] = (double complex) out[2*k+1];                               
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
FFT.cpp:29:26: error: expected ')'
    out[2*k+1] = (double complex) val[k]/N;
                         ^
FFT.cpp:29:18: note: to match this '('
    out[2*k+1] = (double complex) val[k]/N;
                 ^
FFT.cpp:29:18: error: C-style cast from 'const double *' to 'double' is not allowed
    out[2*k+1] = (double complex) val[k]/N;
                 ^~~~~~~~~~~~~~~~~~~~~~~
FFT.cpp:30:26: error: expected ')'
    out[2*k]   = (double complex) 0;
                         ^
FFT.cpp:30:18: note: to match this '('
    out[2*k]   = (double complex) 0;
                 ^
FFT.cpp:30:16: error: array type 'fftw_complex' (aka 'double[2]') is not assignable
    out[2*k]   = (double complex) 0;
    ~~~~~~~~   ^
3 warnings and 6 errors generated.
make: *** [FFT.o] Error 1
ai-mannamalai commented 1 month ago

C99 compiler required apparently and there's lot going on that's non-standard; I give up too :(