lducas / FHEW

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined refrence to 'fftw_malloc' in 'libfhew.a'

alphacristi opened this issue · comments

I am trying to make a wrapper over FHEW that provides operations like XOR , OR , AND , etc.
So i have a wrapper class wich contains a secret and a evaluation key.
In the constructor of this class i make a call of FHE::Setup() and i got these errors :

/home/cristi/FHE/FHEW-master/build/lib/libfhew.a(FHEW.o): In function FHEW::KeyGen(FHEW::EvalKey*, int const*)': FHEW.cpp:(.text+0x29a): undefined reference tofftw_malloc'
FHEW.cpp:(.text+0x2c0): undefined reference to fftw_malloc' /home/cristi/FHE/FHEW-master/build/lib/libfhew.a(FHEW.o): In functionFHEW::fread_ek(IO_FILE)':
FHEW.cpp:(.text+0x498): undefined reference to fftw_malloc' /home/cristi/FHE/FHEW-master/build/lib/libfhew.a(FFT.o): In functionFFTsetup()':
FFT.cpp:(.text+0xa): undefined reference to fftw_malloc' FFT.cpp:(.text+0x1b): undefined reference tofftw_malloc'
FFT.cpp:(.text+0x3b): undefined reference to fftw_plan_dft_r2c_1d' FFT.cpp:(.text+0x5f): undefined reference tofftw_plan_dft_c2r_1d'
/home/cristi/FHE/FHEW-master/build/lib/libfhew.a(FFT.o): In function FFTforward(doublecomplex *, int const_)': FFT.cpp:(.text+0x126): undefined reference to fftw_execute'
/home/cristi/FHE/FHEW-master/build/lib/libfhew.a(FFT.o): In functionFFTbackward(int_, doublecomplex const_)': FFT.cpp:(.text+0x200): undefined reference to fftw_execute'
collect2: error: ld returned 1 exit status
make[2]: *** [FHEW_max] Error 1
make[1]: *** [CMakeFiles/FHEW_max.dir/all] Error 2
make: *** [all] Error 2
*** Failure: Exit code 2 ***

When i remove the call of FHEW::Setup() i have no erros.
From these lines :

/home/cristi/FHE/FHEW-master/build/lib/libfhew.a(FHEW.o): In function
FHEW::KeyGen(FHEW::EvalKey*, int const*)': FHEW.cpp:(.text+0x29a): undefined reference tofftw_m1alloc'
FHEW.cpp:(.text+0x2c0): undefined reference to `fftw_malloc'

i believe the problem is inside fhew library, am i right ?
Thank you.

Since FHEW compile on itself, my first guess is that no, the problem is not inside FHEW.

1/ Have you installed the fftw3 library ?
2/ Are you compiling with the flags -lfftw3 ? (see as an example what the Makefile do:

g++ -Wall -O3 -o cmd/gen cmd/gen.cpp common.o -L. -lfhew -lfftw3

Regards, Leo

I have installed fftw3 library and used " -lfhew -lfftw3 " flags but it seems that i didn't place them in the correct order.
Thank you for your response.