These instructions were tested in macOS Mojave but should also work for other recent releases. It is assumed that the clang compiler that comes with Xcode is used for building PALISADE.
- Install the Mac terminal command line functions if needed (type
gitat the command line to trigger the install). Then install home-brew if not already present:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- Install pre-requisites cmake, autoconf, and OpenMP library using Homebrew:
brew install cmake brew install autoconf brew install libomp
(Optional) For GMP/NTL, you may need to install the following archiving tools
brew install gnu-tar brew install lzip
Clone the repo.
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".
mkdir build cd build cmake ..
Cmake will check for any system dependencies that are needed for the build process. If you run into any issues, please review the following two notes.
Note there are issues with some versions of clang/OMP and regular expressions that may cause cmake to fail. The general fix is to run cmake twice. There are two distinct cases. If you get an error about a missing regular expression backend, run the following commands:
mkdir build cd build cmake -DCMAKE_CROSSCOMPILING=1 -DRUN_HAVE_STD_REGEX=0 -DRUN_HAVE_POSIX_REGEX=0 .. cmake ..
If you get an error about OMP asking to rerun cmake, just run "cmake .." once more.
The PALISADE distribution includes some external libraries, such as GMP. NTL and tcmalloc. If you want to use any of these libraries, enable them when you run cmake to force them to build (see instructions on cmake options).
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, where # is the number of cores on your machine).
(Optional) If NTL/GMP was chosen using "-DWITH_NTL=ON", NTL will need to be built before running "make". You will need to unpack and install both GMP and NTL first (the makefile will warn you if you haven't but will then fail).
make gmp_unpack make gmp_all make ntl_unpack make ntl_all
note ntl can be compiled to an unoptimized state by instead running
which skips running the wizard optimization step during the subsequent
ntl_all, vastly speeding up the install. Once these are installed you can make the system with
- Install PALISADE in a system directory (if desired or for production purposes)
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 ..
Testing and cleaning the build
Run unit tests to make sure all capabilities operate as expected
Run sample code to test, e.g.,
To remove the files built by make, you can execute