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

How do I run the examples #334

Open wqzdhrdhr opened 4 years ago

wqzdhrdhr commented 4 years ago

Your Contact: Your environment (OS/HW):ubuntu 18.04 Detailed Description:After compiling helib, I don't know how to run the program in the examples. Execute cmake . in BGV_general_example, and display:

CMake Error at CMakeLists.txt:13 (find_package):
  By not providing "Findhelib.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "helib", but
  CMake did not find one.

  Could not find a package configuration file provided by "helib" (requested
  version 1.0.0) with any of the following names:

    helibConfig.cmake
    helib-config.cmake

  Add the installation prefix of "helib" to CMAKE_PREFIX_PATH or set
  "helib_DIR" to a directory containing one of the above files.  If "helib"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!

Thank you.

esteffin commented 4 years ago

Hi, from what you wrote, it seems like the issue is that when you are configuring the BGV_general_example project you are not telling CMake where HElib is installed. To do so, make sure that after building HElib you are installing it in the system using make install. Then in the examples/BGV_general_example run cmake -Dhelib_DIR=<helib install prefix>/share/cmake/helib . where <helib install prefix> is the location where you installed HElib (the folder containing the lib, include, and share directories). This step is described at the end of INSTALL.md, precisely at "Package build with cmake" pt 2. I also recommend you to use CMake to do out of source builds. To do this from the examples/BGV_general_example directory just do

mkdir build
cd build
cmake -Dhelib_DIR=<helib install prefix>/share/cmake/helib .. 

This will keep the directories cleaner.

juy13 commented 4 years ago

I understood. You can install it in /usr/local and cmake will find it, it's easier than do it by yourself, but I don't know if it's correct

christianepeters commented 3 years ago

I compressed the install instructions to the bare minimum for people who just want to install the code and play around with the examples.

I can run the 'packed arithmetic example' on a MacBook Air (Retina, 13-inch, 2018) with MacOS Catalina installed and on a 7-year old Acer Aspire 7 running Ubuntu 20.04.

sirtimrod commented 3 years ago

@christianepeters Thank you sooo much, you saved my brain