Installation
Welcome to the OpenFHE installation instructions! For OS-specific instructions, follow one of the following links below, or proceed with the high-level platform-independent installation instructions below.
Note
Note: By default, the library is built without external dependencies. But the user is also provided options to add
GMP/NTLtcmallocand/or
Intel HEXLthird-party libraries if desired
Contents:
Build Instructions
We use CMake to build OpenFHE. OpenFHE supports any GNU C++ compiler version 9 or above and clang C++ compiler version 10 or above.
Install system prerequisites (if not already installed), including a C++ compiler with OMP support, cmake, make.
Clone the OpenFHE repo to your local machine.
Create a directory where the binaries will be built. The typical choice is a subfolder “build”. In this case, the commands are:
mkdir build cd build cmake ..
Note
CMake will check for any system dependencies that are needed for the build process
If the
CMakebuild does not complete successfully, please review the errorCMakeshows at the end.If the error does not go away (even though you installed the dependency), try running
make cleanto clear the CMake cache.
If you want to use any external libraries, such as NTL/GMP or tcmalloc, install these libraries.
5. Build OpenFHE by running the following command (this will take few minutes; using the -j make command-line flag is suggested to speed up the build)
make
If you want to build only library files or some other subset of OpenFHE, please review the last paragraph of this page.
After the
makecompletes, you should see the OpenFHE library files in the lib folder, binaries of examples inbin/examples, binaries of benchmarks inbin/benchmark, and binaries for unit tests in the unittest folder.
Install OpenFHE to a system directory (if desired or for production purposes)
make install
You would probably need to run sudo make install unless you are specifying some other install location. You can change the install location by running
cmake -DCMAKE_INSTALL_PREFIX=/your/path ...
The header files are placed in the
include/openfhefolder of the specified path, and the binaries of the library are copied directly to thelibfolder. For example, if no installation path is provided in Ubuntu (and many other Unix-based OSes), the header and library binary files will be placed in/usr/local/include/openfheand/usr/local/lib, respectively.
Testing and cleaning the build
Run unit tests to make sure all capabilities operate as expected
make testall
Run sample code to test, e.g.,
bin/examples/pke/simple-integers
To remove the files built by make, you can execute
make clean
Supported Operating Systems
OpenFHE CI continually tests our builds on the following operating systems:
Ubuntu [18.04] [20.04]
macOS [Mojave]
Centos 7
NVIDIA Xavier [Linux for Tegra 4.2.2]
MinGW (64-bit) on Windows 10
OpenFHE users have reported successful operation on the following systems:
FreeBSD
Ubuntu [16.04] [22.04] [23.04]
macOS [Monterey] [Ventura]
Arch Linux
Please let us know the results if you have run OpenFHE any additional systems not listed above.