Setting up Facebook Folly on Ubuntu

This is how I installed the Facebook Folly C++ libraries on Ubuntu.

Step 1: The source

I downloaded from and unzipped it, creating the directory /home/martin/folly-master.

Step 2: Install prerequisites

I just installed everything mentioned in the I had most of these already:

sudo apt-get install \
    g++ \
    automake \
    autoconf \
    autoconf-archive \
    libtool \
    libboost-all-dev \
    libevent-dev \
    libdouble-conversion-dev \
    libgoogle-glog-dev \
    libgflags-dev \
    liblz4-dev \
    liblzma-dev \
    libsnappy-dev \
    make \
    zlib1g-dev \
    binutils-dev \
    libjemalloc-dev \
    libunwind8-dev \
    libelf-dev \

Step 3: Build

autoreconf -ivf
sudo make install

I couldn’t get make check to work because Google Test has changed, so I skipped that step.

Step 4: Install header files

sudo mkdir /usr/include/folly
sudo mkdir /usr/include/folly/detail
sudo cp /home/martin/folly-master/folly/*.h /usr/include/folly
sudo cp /home/martin/folly-master/folly/detail/*.h /usr/include/folly/detail
sudo cp -r /home/martin/folly-master/folly/compatibility /usr/include/folly

I’m not sure if copying the header files from detail was necessary, but it doesn’t do any harm.

Step 5: Install the libraries

sudo cp /home/martin/folly-master/folly/.libs/ /usr/local/lib
cd /usr/local/lib
sudo ln -s
sudo ln -s
sudo ldconfig -v

Step 6: Try it

I wrote this program in hello.cpp:

#include <iostream>
#include <folly/FBString.h>

int main()
    folly::fbstring str("Hello, Folly World!");
    std::cout << str << "\n";

I compiled it like this:

g++ hello.cpp -o hello -lfolly

Finally, I ran it:

Hello, Folly World!