Installation Guide

This guide provides instructions for compiling and installing the Cuckoo Filter library.

Prerequisites

To build the library and its examples, you will need the following:

  • A C++11 compatible compiler (e.g., g++ or clang++).
  • The make build automation tool.
  • OpenSSL development libraries (for hashing functions). Specifically, libcrypto and libssl.

macOS Specific Instructions

On recent versions of macOS, the OpenSSL header files may not be in the default system path. You can install them using Homebrew and export the necessary flags for the compiler:

# Install OpenSSL via Homebrew
brew install openssl

# Export environment variables (replace version with your installed version)
export LDFLAGS="-L/usr/local/Cellar/openssl/1.0.2j/lib"
export CFLAGS="-I/usr/local/Cellar/openssl/1.0.2j/include"

Compiling the Example

Once the prerequisites are met, you can compile the example test program to verify your setup.

  1. Clone the repository:

    git clone https://github.com/efficient/cuckoofilter.git
    cd cuckoofilter
  2. Run make to build the test executable:

    make test

    This command compiles example/test.cc and links it with the necessary library object files, creating an executable named test in the root directory.

Library Installation

To install the Cuckoo Filter static library and header files system-wide, use the install target. This is useful if you want to link against libcuckoofilter.a in other projects.

# This may require superuser privileges
sudo make install

By default, this command will:

  • Place all header files in /usr/local/include/cuckoofilter/.
  • Place the static library libcuckoofilter.a in /usr/local/lib/.

The installation prefix can be changed by setting the PREFIX variable in the Makefile or on the command line.

Uninstallation

To remove the installed library and header files from your system, you can use the uninstall target:

# This may require superuser privileges
sudo make uninstall