This document will walk you through setting up Xcode to use this Github repository and running a complete mobile application example step by step.
A working Internet connection is required to build the toolkit as some dependencies are fetched from external sources at build time.
We currently offer this version of the toolkit on the X86 architecture only. There are future plans to port it to Apple Silicon & ARM Architecture, but that is not something that is working at this time. We are always welcoming patches and pull requests if someone is interested in contributing.
This toolkit requires the Xcode IDE and some associated command line tools. It also requires the cmake build system to be installed.
This demo will currently run on Xcode 12.x and is set to compile for macOS 10.14 and above. Note that it will run on older versions of macOS and Xcode but some minimum build versions will need to change in the project for it to compile successfully.
Before cloning the repo, install Xcode and the Xcode Command line Tools. The Xcode IDE is the core of the Apple-native development experience and privides a productive environment for building apps for Mac, iPhone, iPad, and other Apple hardware.
To install the required Xcode command line tools, open a Terminal, such as Terminal.app and type the following command:
xcode-select --install
CMake is an open-source, cross-platform family of tools that can be used to build and test software source code. CMake is used to control the software compilation process using platform and compiler independent configuration files as well as generating native makefiles that work with a variety of compilers.
This toolkit has been tested with cmake version 3.19
. Please check whether you have cmake installed in your environment and whether cmake version >= 3.19
by entering the following command in a terminal window :
cmake -version
Should you need to install or reinstall cmake in your environment, precompiled binaries for MacOS are available directly from CMake website. Available binary release that supports Mac OS X 10.7 or later, can be downloaded directly from: https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2-macos-universal.tar.gz. Alternatively cmake is also available as MacPorts Project or Homebrew packages.
If you do not currently have cmake installed, the setup script will attempt to install it for you as it is needed to build the libraries.
To begin, open Xcode. If you are not presented with the Welcome to XCode screen, within the XCode IDE, Select Window -> “Welcome To Xcode”
Select “Clone an existing Project” from the Welcome to Xcode screen.
Enter the Repository URL shown below. This URL can be found in the clone or download button of the GitHub repository.
https://github.com/IBM/fhe-toolkit-macos.git
You will next be asked which branch you would like to clone. Select the "master" branch as shown and click the clone button to begin the source code copy process. The clone may take a few minutes depending on your network bandwidth and connectivity.
Next you will be presented with a location where to download the locally cloned code. Select any location that makes sense for you and click the Clone button.
NOTE: You will need this location for our next step so remember the location
Once the download completes, the cloned git repository is almost ready for use with Xcode.
Now that you have the toolkit repo cloned, along with the automatically included dependency code repositories, we must first compile those dependency libraries. To do this you must use a terminal application and cd
into the dependencies
directory from the root of the repo. The root location was entered in the previous step.
cd dependencies
Now from within the dependencies folder, you can trigger the setup.sh
script to compile the dependency libraries (NTL and GMP).
./setup.sh
After the dependencies finish building, go back to Xcode and open the workspace fhe-toolkit-macos.xcworkspace
. If you previously had it open close it and re-open.
At this point you can build and run the example applications showing the FHE capability. Each demonstration application is a self contained target that builds a macOS application by clicking Build. Each demo application directory contains a README.md that explains how to run the demo and what you should expect for results. There are two demonstrations to choose from, Privacy Preserving Search, and Credit Card Fraud.