Sunday, November 27, 2022

[How To] Install HElib on macOS


HElib is an open-source (Apache License v2.0) software library that implements homomorphic encryption (HE). Currently, available schemes are the implementations of the Brakerski-Gentry-Vaikuntanathan (BGV) scheme and the Approximate Number scheme of Cheon-Kim-Kim-Song (CKKS), along with many optimizations to make homomorphic evaluation runs faster, focusing mostly on effective use of the Smart-Vercauteren ciphertext packing techniques and the Gentry-Halevi-Smart optimizations. To install HElib on macOS, follow these steps:

Cloning into 'HElib'...

remote: Enumerating objects: 14133, done.

remote: Counting objects: 100% (292/292), done.

remote: Compressing objects: 100% (211/211), done.

remote: Total 14133 (delta 127), reused 172 (delta 54), pack-reused 13841

Receiving objects: 100% (14133/14133), 13.04 MiB | 5.81 MiB/s, done.

Resolving deltas: 100% (10853/10853), done.

  • cd HElib/

  • mkdir build

  • cd build 

  • cmake -DPACKAGE_BUILD=ON -DENABLE_TEST=ON ..

-- The C compiler identification is AppleClang 14.0.0.14000029

-- The CXX compiler identification is AppleClang 14.0.0.14000029

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped

-- Detecting C compile features

-- Detecting C compile features - done

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success

-- Found Threads: TRUE  

CMake Warning at CMakeLists.txt:264 (message):

  CAUTION: Package build should not be installed globally as it will

  potentially override dependencies.



CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/ExternalProject.cmake:3074 (message):

  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is

  not set.  The policy's OLD behavior will be used.  When using a URL

  download, the timestamps of extracted files should preferably be that of

  the time of extraction, otherwise code that depends on the extracted

  contents might not be rebuilt if the URL changes.  The OLD behavior

  preserves the timestamps from the archive instead, but this is usually not

  what you want.  Update your project to the NEW behavior or specify the

  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this

  robustness issue.

Call Stack (most recent call first):

  /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/ExternalProject.cmake:4170 (_ep_add_download_command)

  dependencies/gmp/CMakeLists.txt:25 (ExternalProject_Add)

This warning is for project developers.  Use -Wno-dev to suppress it.


CMake Warning (dev) at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/ExternalProject.cmake:3074 (message):

  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is

  not set.  The policy's OLD behavior will be used.  When using a URL

  download, the timestamps of extracted files should preferably be that of

  the time of extraction, otherwise code that depends on the extracted

  contents might not be rebuilt if the URL changes.  The OLD behavior

  preserves the timestamps from the archive instead, but this is usually not

  what you want.  Update your project to the NEW behavior or specify the

  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this

  robustness issue.

Call Stack (most recent call first):

  /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/ExternalProject.cmake:4170 (_ep_add_download_command)

  dependencies/ntl/CMakeLists.txt:59 (ExternalProject_Add)

This warning is for project developers.  Use -Wno-dev to suppress it.


-- /Users/devharsh/Downloads/HElib/build

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/devharsh/Downloads/HElib/build

  • make -j16

  • ctest 

Test project /Users/devharsh/Downloads/HElib/build

      Start  1: GTestApproxNums

 1/44 Test  #1: GTestApproxNums ............................   Passed    0.32 sec

      Start  2: GTestBinaryArith

 2/44 Test  #2: GTestBinaryArith ...........................   Passed    9.22 sec

      Start  3: GTestBinaryCompare

 3/44 Test  #3: GTestBinaryCompare .........................   Passed    4.14 sec

      Start  4: GTestBootstrapping

 4/44 Test  #4: GTestBootstrapping .........................   Passed   89.48 sec

      Start  5: GTestEaCx

 5/44 Test  #5: GTestEaCx ..................................   Passed    0.04 sec

      Start  6: GTestEvalMap

 6/44 Test  #6: GTestEvalMap ...............................   Passed    4.25 sec

      Start  7: GTestExtractDigits

 7/44 Test  #7: GTestExtractDigits .........................   Passed   31.85 sec

      Start  8: GTestFatboot

 8/44 Test  #8: GTestFatboot ...............................   Passed   36.54 sec

      Start  9: GTestGeneral

 9/44 Test  #9: GTestGeneral ...............................   Passed  125.39 sec

      Start 10: GTestIntraSlot

10/44 Test #10: GTestIntraSlot .............................   Passed    0.05 sec

      Start 11: GTestMatmul

11/44 Test #11: GTestMatmul ................................   Passed   25.20 sec

      Start 12: GTestPAlgebra

12/44 Test #12: GTestPAlgebra ..............................   Passed    0.04 sec

      Start 13: GTestPGFFT

13/44 Test #13: GTestPGFFT .................................   Passed   58.80 sec

      Start 14: GTestPolyEval

14/44 Test #14: GTestPolyEval ..............................   Passed   52.67 sec

      Start 15: GTestPowerful

15/44 Test #15: GTestPowerful ..............................   Passed    0.04 sec

      Start 16: GTestPtrVector

16/44 Test #16: GTestPtrVector .............................   Passed    0.04 sec

      Start 17: GTestReplicate

17/44 Test #17: GTestReplicate .............................   Passed    2.71 sec

      Start 18: GTestTableLookup

18/44 Test #18: GTestTableLookup ...........................   Passed    9.98 sec

      Start 19: GTestThinboot

19/44 Test #19: GTestThinboot ..............................   Passed    4.44 sec

      Start 20: GTestThinBootstrapping

20/44 Test #20: GTestThinBootstrapping .....................   Passed    7.77 sec

      Start 21: GTestThinEvalMap

21/44 Test #21: GTestThinEvalMap ...........................   Passed    3.41 sec

      Start 22: TestArgMap

22/44 Test #22: TestArgMap .................................   Passed    0.13 sec

      Start 23: TestBGV

23/44 Test #23: TestBGV ....................................   Passed    0.30 sec

      Start 24: TestCKKS

24/44 Test #24: TestCKKS ...................................   Passed    0.57 sec

      Start 25: TestClonedPtr

25/44 Test #25: TestClonedPtr ..............................   Passed    0.04 sec

      Start 26: TestContext

26/44 Test #26: TestContext ................................   Passed    0.07 sec

      Start 27: TestCtxt

27/44 Test #27: TestCtxt ...................................   Passed    4.15 sec

      Start 28: TestErrorHandling

28/44 Test #28: TestErrorHandling ..........................   Passed    0.04 sec

      Start 29: TestFatBootstrappingWithMultiplications

29/44 Test #29: TestFatBootstrappingWithMultiplications ....   Passed   39.82 sec

      Start 30: TestHEXL

30/44 Test #30: TestHEXL ...................................   Passed    0.04 sec

      Start 31: TestLogging

31/44 Test #31: TestLogging ................................   Passed    0.04 sec

      Start 32: TestMatmulCKKS

32/44 Test #32: TestMatmulCKKS .............................   Passed    0.04 sec

      Start 33: TestMatrix

33/44 Test #33: TestMatrix .................................   Passed    0.06 sec

      Start 34: TestPartialMatch

34/44 Test #34: TestPartialMatch ...........................   Passed    8.03 sec

      Start 35: TestPermutations

35/44 Test #35: TestPermutations ...........................   Passed   50.42 sec

      Start 36: TestPolyMod

36/44 Test #36: TestPolyMod ................................   Passed    0.04 sec

      Start 37: TestPolyModRing

37/44 Test #37: TestPolyModRing ............................   Passed    0.04 sec

      Start 38: TestPtxt

38/44 Test #38: TestPtxt ...................................   Passed    0.59 sec

      Start 39: TestQuery

39/44 Test #39: TestQuery ..................................   Passed    0.04 sec

      Start 40: TestSet

40/44 Test #40: TestSet ....................................   Passed    3.04 sec

      Start 41: TestThinBootstrappingWithMultiplications

41/44 Test #41: TestThinBootstrappingWithMultiplications ...   Passed    7.65 sec

      Start 42: TestBinIO

42/44 Test #42: TestBinIO ..................................   Passed    1.36 sec

      Start 43: TestIO

43/44 Test #43: TestIO .....................................   Passed    0.30 sec

      Start 44: TestVersion

44/44 Test #44: TestVersion ................................   Passed    0.03 sec


100% tests passed, 0 tests failed out of 44


Total Test time (real) = 583.30 sec

  • sudo make install

  • g++ -I/usr/local/helib_pack/include -L/Users/devharsh/Downloads/HElib/build/helib_pack/lib -std=c++17 -lntl -lhelib homcomparison.cpp 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.