A common init function for binaries and a default main function for tests
[folly.git] / README.md
1 Folly: Facebook Open-source Library
2 -----------------------------------
3
4 Folly is an open-source C++ library developed and used at Facebook.
5
6 ###[Get Started](folly/docs/Overview.md)
7
8 Folly is published on Github at https://github.com/facebook/folly; for
9 discussions, there is a Google group at
10 https://groups.google.com/d/forum/facebook-folly.
11
12 Dependencies
13 ------------
14
15 folly requires gcc 4.8+ and a version of boost compiled with C++11 support.
16
17 Please download googletest from
18 https://googletest.googlecode.com/files/gtest-1.7.0.zip and unzip it in the
19 folly/test subdirectory.
20
21 Ubuntu 12.04
22 ------------
23
24 This release is old, requiring many upgrades. However, since Travis CI runs
25 on 12.04, `folly/build/deps_ubuntu_12.04.sh` is provided, and upgrades all
26 the required packages.
27
28 Ubuntu 13.10
29 ------------
30
31 The following packages are required (feel free to cut and paste the apt-get
32 command below):
33
34 ```
35 sudo apt-get install \
36     g++ \
37     automake \
38     autoconf \
39     autoconf-archive \
40     libtool \
41     libboost-all-dev \
42     libevent-dev \
43     libdouble-conversion-dev \
44     libgoogle-glog-dev \
45     libgflags-dev \
46     liblz4-dev \
47     liblzma-dev \
48     libsnappy-dev \
49     make \
50     zlib1g-dev \
51     binutils-dev \
52     libjemalloc-dev \
53     libssl-dev \
54     libunwind8-dev \
55     libelf-dev \
56     libdwarf-dev
57 ```
58
59 Ubuntu 14.04 LTS
60 ----------------
61
62 The packages listed above for Ubuntu 13.10 are required, as well as:
63
64 ```
65 sudo apt-get install \
66     libiberty-dev
67 ```
68
69 The above packages are sufficient for Ubuntu 13.10 and Ubuntu 14.04.
70
71 In the folly directory, run
72 ```
73   autoreconf -ivf
74   ./configure
75   make
76   make check
77   sudo make install
78 ```
79
80 OS X (Homebrew)
81 ----
82 folly is available as a Formula and releases may be built via `brew install folly`.
83
84 You may also use `folly/build/bootstrap-osx-homebrew.sh` to build against `master`:
85
86 ```
87   cd folly
88   ./build/bootstrap-osx-homebrew.sh
89   make
90   make check
91 ```
92
93 OS X (MacPorts)
94 ----
95 Install the required packages from MacPorts:
96
97 ```
98   sudo port install \
99     autoconf \
100     automake \
101     boost \
102     gflags \
103     git \
104     google-glog \
105     libevent \
106     libtool \
107     lz4 \
108     lzma \
109     scons \
110     snappy \
111     zlib
112 ```
113
114 Download and install double-conversion:
115
116 ```
117   git clone https://github.com/google/double-conversion.git
118   cd double-conversion
119   cmake -DBUILD_SHARED_LIBS=ON .
120   make
121   sudo make install
122 ```
123
124 Download and install folly with the parameters listed below:
125
126 ```
127   git clone https://github.com/facebook/folly.git
128   cd folly/folly
129   autoreconf -ivf
130   ./configure CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib"
131   make
132   sudo make install
133 ```
134
135 Other Linux distributions
136 -------------------------
137
138 - double-conversion (https://github.com/google/double-conversion)
139
140   Download and build double-conversion.
141   You may need to tell configure where to find it.
142
143   [double-conversion/] `ln -s src double-conversion`
144
145   [folly/] `./configure LDFLAGS=-L$DOUBLE_CONVERSION_HOME/ CPPFLAGS=-I$DOUBLE_CONVERSION_HOME/`
146
147   [folly/] `LD_LIBRARY_PATH=$DOUBLE_CONVERSION_HOME/ make`
148
149 - additional platform specific dependencies:
150
151   Fedora 21 64-bit
152     - gcc
153     - gcc-c++
154     - autoconf
155     - autoconf-archive
156     - automake
157     - boost-devel
158     - libtool
159     - lz4-devel
160     - lzma-devel
161     - snappy-devel
162     - zlib-devel
163     - glog-devel
164     - gflags-devel
165     - scons
166     - double-conversion-devel
167     - openssl-devel
168     - libevent-devel
169     - libdwarf-dev
170     - libelf-dev
171     - libunwind8-dev