HElib icon indicating copy to clipboard operation
HElib copied to clipboard

Building HElib with HEXL installed via vcpkg fails

Open fboemer opened this issue 3 years ago • 0 comments

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

fboemer avatar Sep 13 '21 18:09 fboemer