microsoft / SEAL

Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
https://www.microsoft.com/en-us/research/group/cryptography-research/
MIT License
3.55k stars 706 forks source link

Integrating SEAL into my project #648

Closed Mikerah closed 1 year ago

Mikerah commented 1 year ago

I'm trying to integrate SEAL into a simple example project to get familiar with SEAL's APIs. I'm encountering the following error when trying to run cmake .. from the build folder:

CMake Error at /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "FindMicrosoft.GSL.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Microsoft.GSL", but CMake did not find one.

  Could not find a package configuration file provided by "Microsoft.GSL"
  with any of the following names:

    Microsoft.GSLConfig.cmake
    microsoft.gsl-config.cmake

  Add the installation prefix of "Microsoft.GSL" to CMAKE_PREFIX_PATH or set
  "Microsoft.GSL_DIR" to a directory containing one of the above files.  If
  "Microsoft.GSL" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  /home/mikerah/Libraries/vcpkg/packages/seal_x64-linux/share/seal/SEALConfig.cmake:68 (find_dependency)
  /home/mikerah/Libraries/vcpkg/packages/seal_x64-linux/share/seal/SEALConfig.cmake:110 (seal_find_dependency)
  CMakeLists.txt:11 (find_package)

CMake Error at CMakeLists.txt:11 (find_package):
  Found package configuration file:

    /home/mikerah/Libraries/vcpkg/packages/seal_x64-linux/share/seal/SEALConfig.cmake

  but it set SEAL_FOUND to FALSE so package "SEAL" is considered to be NOT
  FOUND.

-- Configuring incomplete, errors occurred!

I know in order to resolve this I can simply add Microsoft.GSL_DIR to my .bashrc file as an environment variable but this seems unnecessary. Is there any way to solve this?

fionser commented 1 year ago
  1. Give -DCMAKE_MODULE_PATH to cmake and tell it why your GSL (or other dependencies) is installed
  2. Or just disable these dependences -DSEAL_USE_MSGSL=OFF
  3. Or let SEAL to fetch all the dependencies and build from scratch. -DSEAL_BUILD_DEPS=ON
Mikerah commented 1 year ago

I've tried cmake -DSEAL_USE_MSGSL=OFF -DSEAL_DIR=~/Libraries/vcpkg/packages/seal_x64-linux/share/seal/ .. but I still get the following error:

CMake Error at /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "FindMicrosoft.GSL.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Microsoft.GSL", but CMake did not find one.

  Could not find a package configuration file provided by "Microsoft.GSL"
  with any of the following names:

    Microsoft.GSLConfig.cmake
    microsoft.gsl-config.cmake

  Add the installation prefix of "Microsoft.GSL" to CMAKE_PREFIX_PATH or set
  "Microsoft.GSL_DIR" to a directory containing one of the above files.  If
  "Microsoft.GSL" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  /home/mikerah/Libraries/vcpkg/packages/seal_x64-linux/share/seal/SEALConfig.cmake:68 (find_dependency)
  /home/mikerah/Libraries/vcpkg/packages/seal_x64-linux/share/seal/SEALConfig.cmake:110 (seal_find_dependency)
  CMakeLists.txt:11 (find_package)

CMake Error at CMakeLists.txt:11 (find_package):
  Found package configuration file:

    /home/mikerah/Libraries/vcpkg/packages/seal_x64-linux/share/seal/SEALConfig.cmake

  but it set SEAL_FOUND to FALSE so package "SEAL" is considered to be NOT
  FOUND.

-- Configuring incomplete, errors occurred!
See also "/home/mikerah/Documents/HashCloak/Projects/seal-practice/build/CMakeFiles/CMakeOutput.log".
Mikerah commented 1 year ago

I figured it out. I needed to install SEAL via vcpkg install seal[core] and it removed the need for this dependency.