We use CMake to build PALISADE. The high-level (platform-independent) procedure for building PALISADE is as follows:
-
Install system prerequisites (if not already installed), including a C++ compiler with OMP support, cmake, make, and autoconf.
-
Clone the PALISADE repo to your local machine.
-
Download git submodules by running the following commands (PALISADE downloads submodules for cereal, google-benchmark, google-test, and gperftools open-source libraries):
git submodule sync --recursive
git submodule update --init --recursive
- 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 that CMake will check for any system dependencies that are needed for the build process. If the CMake build does not complete successfully, please review the errors CMake displays to determine any missing dependent components. If the error does not go away (even though you installed the dependency), try running "make clean" to clear the CMake cache.
-
If you want to use any external libraries, such as NTL/GMP and tcmalloc (for maximum run-time performance), install these libraries (see Use of CMake in PALISADE).
-
Build PALISADE by running the following command (this will take few minutes; using the -j make command-line flag is suggested to speed up the build, though our experience shows that systems with 8 GB or less ram may have difficulty with larger values of j).
make
If you want to build only library files or some other subset of PALISADE, please review the last paragraph of this page.
After the make
completes, inside your specified "build" directory you should see all PALISADE library files in the "lib" folder, and other binaries as follows: demos in "bin/demo", benchmarks in "bin/benchmark", examples in "bin/examples" and unit tests in "unittest".
- Install PALISADE 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 that you have write permission for. You can change the install location by running
cmake -DCMAKE_INSTALL_PREFIX=/your/path ..
. The header files are placed in the "include/palisade" folder of the specified path, and the binaries of the library are copied directly to the "lib" folder of the path. For example, if no installation path is provided in Ubuntu (and many other *nix-based OSes), the header and library binary files will be placed in "/usr/local/include/palisade" and "/usr/local/lib", respectively.
Testing and cleaning the build
Once you have built PALISADE (especially for the first time on a new system), we recommend testing.
- Run all unit tests to make sure all capabilities operate as expected
make testall
Note this will run all unit tests for all math backends specified in the initial CMake.
- Run some sample demos e.g.,
bin/examples/pke/simple-integers
bin/examples/pke/simple-real-numbers
bin/examples/pke/advanced-real-numbers
To remove the files built by make, you can execute
make clean