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 760 forks source link

HElib does not build inside VirtualBox #426

Closed g2flyer closed 3 years ago

g2flyer commented 3 years ago

Building HElib inside a VM running on virtualbox will fail with following error

...
[  2%] Building CXX object CMakeFiles/helib.dir/PGFFT.cpp.o
/bin/c++  -DHELIB_BOOT_THREADS -DHELIB_THREADS -I/home/msteiner/src/HElib.git/dependencies/json -I/home/msteiner/src/HElib.git/include -I/home/msteiner/src/HElib.git/build/dependencies/Build/helib_external -isystem /home/msteiner/src/HElib.git/build/helib_pack/include  -O2 -g -DNDEBUG -fPIC   -march=native -std=c++17 -o CMakeFiles/helib.dir/PGFFT.cpp.o -c /home/msteiner/src/HElib.git/src/PGFFT.cpp
In file included from /usr/lib/gcc/x86_64-linux-gnu/9/include/immintrin.h:107,
                 from /home/msteiner/src/HElib.git/src/PGFFT.cpp:65:
/usr/lib/gcc/x86_64-linux-gnu/9/include/fmaintrin.h: In function ▒▒▒helib::{anonous}::PD4 helib::{anonymous}::fmaddsub(helib::{anonymous}::PD4, helib::{anonymous}::PD4, helib::{anonymous}::PD4)▒▒▒:
/usr/lib/gcc/x86_64-linux-gnu/9/include/fmaintrin.h:239:1: error: inlining failed in call to always_inline ▒▒▒__m256d _mm256_fmaddsub_pd(__m256d, __m256d, __m25)▒▒▒: target specific option mismatch
  239 | _mm256_fmaddsub_pd (__m256d __A, __m256d __B, __m256d __C)
      | ^~~~~~~~~~~~~~~~~~
/home/msteiner/src/HElib.git/src/PGFFT.cpp:330:51: note: called from here
...

The issue seems that HElib assumes FMA when AVX2 exists (as probably is always true on actual HW) but Virtualbox does handle only the latter but not the former. See VB Ticket #15471