homenc / HElib

HElib is an open-source software library that implements homomorphic encryption. It supports the BGV scheme with bootstrapping and the Approximate Number CKKS scheme. HElib also includes optimizations for efficient homomorphic evaluation, focusing on effective use of ciphertext packing techniques and on the Gentry-Halevi-Smart optimizations.
https://homenc.github.io/HElib
Other
3.11k stars 761 forks source link

Can't build HElib with DEBUG_PRINTOUT macro #131

Open NanXiao opened 7 years ago

NanXiao commented 7 years ago

If use DEBUG_PRINTOUT macro in Makefile, like this:

CFLAGS = -g -O2 -std=c++11 -pthread -DFHE_THREADS -DFHE_DCRT_THREADS -DFHE_BOOT_THREADS -DDEBUG_PRINTOUT

The fhe.a can be built, but when execute make check, the following errors will be generated:

$ make check
HElib requires NTL version 9.4.0 or higher, see http://shoup.net/ntl
If you get compilation errors, try to add/remove -std=c++11 in Makefile

g++ -g -O0 -std=c++11 -pthread -DFHE_THREADS -DFHE_DCRT_THREADS -DFHE_BOOT_THREADS -DDEBUG_PRINTOUT -o Test_General_x Test_General.cpp fhe.a -L/usr/local/lib -lntl -lgmp  -lm
fhe.a(recryption.o): In function `FHEPubKey::reCrypt(Ctxt&)':
/home/xiaonan/Project/HElib/src/recryption.cpp:278: undefined reference to `printFlag'
/home/xiaonan/Project/HElib/src/recryption.cpp:289: undefined reference to `printFlag'
/home/xiaonan/Project/HElib/src/recryption.cpp:300: undefined reference to `printFlag'
/home/xiaonan/Project/HElib/src/recryption.cpp:309: undefined reference to `printFlag'
fhe.a(recryption.o): In function `extractDigitsPacked(Ctxt&, long, long, long, std::vector<NTL::ZZX, std::allocator<NTL::ZZX> > const&)':
/home/xiaonan/Project/HElib/src/recryption.cpp:453: undefined reference to `printFlag'
fhe.a(recryption.o):/home/xiaonan/Project/HElib/src/recryption.cpp:506: more undefined references to `printFlag' follow
collect2: error: ld returned 1 exit status

The reason is printFlag defined in Test_bootstrapping.cpp, and not included in compiling fhe.a.

I think printFlag should be defined in other places, so when compiling fhe.a, it can be found, thanks!

shaih commented 7 years ago

Right, it should be defined in recryption.cpp. I will move it there next time I push some changes.