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

Building HElib with HEXL installed via vcpkg fails #460

Open fboemer opened 2 years ago

fboemer commented 2 years ago

I'm running into some errors linking to vcpkg-built HEXL from within HElib. Looks like it stems from (https://github.com/homenc/HElib/blob/master/src/CMakeLists.txt#L312-L320), which assumes libhexl.a includes all its dependencies. While this is true for a CMake build of HEXL, this is true is NOT true when building from vcpkg. In particular, CpuFeatures is linked to and not included in the static lib.

Something like target_link_libraries(helib PRIVATE $<TARGET_PROPERTY:HEXL::hexl,INTERFACE_LINK_LIBRARIES>) would need to be added to the HElib CMakeLists.txt to properly link CpuFeatures (though this change by itself causes some other errors)

To reproduce,


vcpkg install hexl

cd /home/fboemer/repos/helibproject/HElib/build
cmake .. -DUSE_INTEL_HEXL=ON -DCMAKE_INSTALL_PREFIX=./ -DHEXL_DIR=/home/fboemer/repos/vcpkg/packages/hexl_x64-linux/share/HEXL -DENABLE_TEST=ON -DCMAKE_BUILD_TYPE=Release -DCpuFeatures_DIR=/home/fboemer/repos/vcpkg/packages/cpu-features_x64-linux/share/CpuFeatures
# -- Intel HEXL found
# -- Intel HEXL Version: 1.2.1 found (minimum required is 1.2.1)
# -- Setting up googletest framework
# -- /home/fboemer/repos/helibproject/HElib/build
# -- Configuring done
# -- Generating done
# -- Build files have been written to: /home/fboemer/repos/helibproject/HElib/build

make
# /usr/bin/ld: ../../lib/libhelib.a(eltwise-add-mod.cpp.o): in function `_GLOBAL__sub_I_eltwise_add_mod.cpp':
eltwise-add-mod.cpp:(.text.startup+0x84): undefined reference to `GetX86Info'
``

@jlhcrawford , @hamishun , FYI