lducas / FHEW

Other
218 stars 46 forks source link

Compile errors #5

Closed dbkaplun closed 7 years ago

dbkaplun commented 9 years ago
 02:10:17  dan@elise:~/FHEW   master ✔ 
$ make
g++ -Wall -O3 -c distrib.cpp
In file included from distrib.cpp:2:
In file included from ./distrib.h:4:
./params.h:5:10: fatal error: 'fftw3.h' file not found
#include <fftw3.h>
         ^
1 error generated.
make: *** [distrib.o] Error 1

 02:10:44  ✘ 130  dan@elise:~/FHEW   master ✔ 
$ brew install fftw
==> Downloading https://homebrew.bintray.com/bottles/fftw-3.3.4_1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring fftw-3.3.4_1.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/fftw/3.3.4_1: 39 files, 11M

 02:10:53  dan@elise:~/FHEW   master ✔ 
$ make
g++ -Wall -O3 -c distrib.cpp
In file included from distrib.cpp:2:
In file included from ./distrib.h:4:
./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};
                                    ~^ ~~
2 warnings generated.
g++ -Wall -O3 -c FFT.cpp
In file included from FFT.cpp:3:
In file included from ./FFT.h:4:
./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;
    ~~~~~~~~   ^
2 warnings and 6 errors generated.
make: *** [FFT.o] Error 1
lducas commented 9 years ago

This issue seems to be related to your OS (I had several report of the same issue on MacOS). This issue typically don't arise with linux systems.

thomasdziedzic commented 8 years ago

just encountered this same issue:

g++ is actually linked to clang on mac:

$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
lducas commented 8 years ago

I am sorry I can mot reproduce the error to debug it, as I don't own this OS. (also, FHEW is a project I'm happy to share for reproducibility of scientific claims, but I have no time nor intention to maintain it). I'd be happy to accept a pull request if you have a fix though.

Best -- Leo