Evernote Tech Blog

The Care and Feeding of Elephants

Building Apache Thrift on Mac OS X

If you follow this blog, you’re already well aware that the Evernote API is built on the Apache Thrift framework. Our client SDKs give you everything you need to use the API, so most developers don’t actually have to understand much about Thrift. From time to time, though, somebody wants use our Thrift IDLs to compile their own client-side code. Most of our engineers use Macs, and we’ve found that building the Thrift compiler on OS X can be a bit of a challenge. So that we won’t forget how to do it next time, and to help you if you’re trying to do it yourself, here are the basic steps to build Thrift from source on OS X:

  1. Grab the latest Thrift distribution (currently 0.9.0) from http://thrift.apache.org/
  2. Install Xcode from the Mac App Store
  3. Launch Xcode, open the Preferences, select Downloads, and install the “Command Line Tools for Xcode” component.
  4. Install Homebrew
    ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
    brew doctor
  5. Use Homebrew to install autoconf, automake, libtool and pkg-config
    brew install autoconf automake libtool pkg-config
  6. Use Homebrew to install Boost
    brew install boost
  7. Open compiler/cpp/src/thriftl.ll and change
    #include "thrifty.h"

    to

    #include "thrifty.hh"
  8. Build Thrift
    bootstrap.sh
    configure
    make

You’ll find the Thrift compiler at compiler/cpp/thrift. To compile the Evernote API IDLs, simply run the following command, where “lang” is the programming language that you’re compiling for:

compiler/cpp/thrift -r --gen lang NoteStore.thrift
  1. As long as you have homebrew installed, why not just use `brew install thrift`?

    • Excellent point. If all you need is the stock Thrift compiler, then `brew install thrift` will get you the latest and you’re good to go. We’ve customized the compiler for our own use internally, and generally when people want to compile our IDLs themselves, they’re doing it so that they can make a customization or add support for a new language/environment.

  2. Please give me some feature to sort my notes within a book,
    up now I can do it by alpha, vesion and date.
    I need more!
    Glossary and links to crossreferences
    Flags to change order 1,2,3,4,5,6,7,……..
    etc…..


Leave a Comment

* Required fields